Exporting To Word Code No Longer Working

ian_w

Registered User.
Local time
Today, 23:51
Joined
Jun 13, 2006
Messages
64
Hi,

I have an Access 97 application that exports data to a MS Word template.

Using Windows XP this code works fine, I have recently attempted to run this code on a Windows 7 machine and it fails with the error..

Run Time Error '5981'
Could not open macro storage.

I have tried making the user a full admin on the machine but this has had no effect.

Below is the code that is failing..

Code:
    Set WdApp = CreateObject("Word.Application")

    With WdApp
        
        'Open new file based on template.
        .Documents.add (Template_Path & "Invoice.dot")

It fails when it hits the .Documents.add line.

So far I haven't had any luck in getting the current code to run, if anyone can suggest an alternative way of producing the document then I am open to idea's.
 
So what's inside
Template_Path and is/should it still be the same as on XP?
 
So what's inside
Template_Path and is/should it still be the same as on XP?

Hi,

Template_Path is just a global variable that holds the path to the templates.

Putting the path directly in e.g "J:\Templates\Invoice.dot" results in the same error.
 
Re: Exporting To Word Code No Longer Working 5981 runtime error

Hi Ian

I have similar problem - we use Access 97 with a routine to fill bookmarks in Word 97 document templates. Worked fine on Win XP but gives 5981run time error on Win 7. The document opens fine but loads nothing to the bookmarks.

(Would post the code but unable to - I think because I am a new member)

Not sure exactly where it is failing - not sure how to find that out either.

I have looked extensively on the net but found nothing that helps me (or that I understand) so far. Any clues from anyone greatly appreciated.
 

Users who are viewing this thread

Back
Top Bottom