[dba-Tech] Problem with Word Automation

Susan Harkins ssharkins at setel.com
Wed May 9 12:34:43 CDT 2007


  '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. 




More information about the dba-Tech mailing list