[AccessD] Problem with Word Automation

Mark A Matte markamatte at hotmail.com
Wed May 9 13:19:39 CDT 2007


Susan,

Being that I just fought excel automation...I plugged your info into my 
examples...and here is what I got.  Let me know if it works.

Thanks,

Mark
****************CODE***********
  Dim appWord As Word.Application
  Dim doc As Word.Document

  Set appWord = New Word.Application

  With appWord
    .Documents.Open ("c:\temp\Charlotte_Test")
    .Visible = True
    End With
****************END_CODE***********

>From: "Susan Harkins" <ssharkins at setel.com>
>Reply-To: Access Developers discussion and problem 
>solving<accessd at databaseadvisors.com>
>To: "'Discussion of Hardware and Software 
>issues'"<dba-tech at databaseadvisors.com>,        
><AccessD at databaseadvisors.com>
>Subject: [AccessD] Problem with Word Automation
>Date: Wed, 9 May 2007 13:34:43 -0400
>
>   'Print customer slip for current customer.
>   Dim appWord As Word.Application
>   Dim doc As Word.Document
>   'Dim rst As ADODB.Recordset
>   'Dim strSQL As String
>
>   'Set appWord = GetObject(, "Word.Application")
>
>   Set appWord = New Word.Application
>
>   'With appWord
>   'Set doc = appWord.Documents("Customer Slip")
>
>   On Error GoTo errHandler
>   Set doc = appWord.Documents.Open("C:\WordForms\Customer Slip", , True)
>
>As you can see from the commented lines, I've tried a number of ways to
>retrieve a Word document named Customer Slip -- I want to fill predefined
>fields with Access data.
>
>If I tried to set the Documents property to the file name I get a "bad 
>file"
>error. If I try to do it in the .Open method, I get the following:
>
>-2147417851
>Automation error
>The server threw an exception.
>
>I don't have a clue what that means.
>
>Susan H.
>
>--
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com

_________________________________________________________________
More photos, more messages, more storage—get 2GB with Windows Live Hotmail. 
http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_2G_0507




More information about the AccessD mailing list