[dba-Tech] Problem with Word Automation

Bryan Carbonnell carbonnb at gmail.com
Wed May 9 13:20:37 CDT 2007


On 5/9/07, Susan Harkins <ssharkins at setel.com> wrote:

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

Is this a cut & paste?

If it is
Set doc = appWord.Documents.Open("C:\WordForms\Customer Slip", , True)

should probably be
Set doc = appWord.Documents.Open("C:\WordForms\Customer Slip.doc", , True)

you left off the .doc

-- 
Bryan Carbonnell - carbonnb at gmail.com
Life's journey is not to arrive at the grave safely in a well
preserved body, but rather to skid in sideways, totally worn out,
shouting "What a great ride!"



More information about the dba-Tech mailing list