Link to home
Start Free TrialLog in
Avatar of jojahn
jojahn

asked on

Export Access to Word template

I  export an access report to a Word Template. Everything is working great.
With the installation of another computer, we want to share the database between the computers, too. Even that is working! The database and the templates are in a Mapped folder.
If I try to create the Word document from the "external" computer, the  code line
'Set doc = wrdApp.Documents.Add(strPath & contemplate)'  is set to NULL. The path and the file name are correct and can be monitored in step mode.
All computers have the right to read and write to the shared drive!
The "external" computer can regerate the word file with the data as a table in it (RTF file)!!
Who can help me?

Josh




    ' Export the data to rtf format
    DoCmd.OutputTo acOutputQuery, conquery, _
     acFormatRTF, strDataSource, False

    ' Start Word using mailmerge template
    Set wrdApp = New Word.Application
    Set doc = wrdApp.Documents.Add(strPath & contemplate)   '<<<======
   
    ' Do the mail merge to a new document.
    With doc.MailMerge
        .OpenDataSource Name:=strDataSource
        .Destination = wdSendToNewDocument
        .SuppressBlankLines = True
        With .DataSource
            .FirstRecord = wdDefaultFirstRecord
            .LastRecord = wdDefaultLastRecord
        End With
        If .State = wdMainAndDataSource Then
            .Execute
        End If
    End With
   
    ' Display the mail merge document
    wrdApp.Visible = True
    wrdApp.WindowState = wdWindowStateMaximize
 
ExitHere:
    doc.Close (wdDoNotSaveChanges)
    Set doc = Nothing
   
    Set wrdApp = Nothing
    Exit Sub
   
HandleErrors:   etc. etc. etc.
Avatar of oleggold
oleggold
Flag of United States of America image

did You try to add word object to Your vb project?
at least Microsoft Office object library,I mean,on external computer
ASKER CERTIFIED SOLUTION
Avatar of jojahn
jojahn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial