RE: Opening a Word Document from Access

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Do you have reference to Microsoft Word 11.0 Object Library?
To check open any code section, or the immidiate window, select tools,
reference.
If you dont have then create by browsing and selecting MSWORD.OLB, probably
under c:\Program Files\Microsoft Office\Office11\

But its better to check by searching for it.


"turner" wrote:

> I am trying to Open a Word Document from an Access form "User Documentation"
> I get an Automation Error. I am using Access 2000 for testing. However, it
> will be installed using Access 97. Could some one please help:
>
> Private Sub Command0_Click()
>
> Dim objword As Word.Application
> Dim objDoc As Word.Document
> Dim DocPath As String
>
> DocPath = "c:\MyPath\UserDoc.doc"
>
> Set objword = New Word.Application
>
> '************************************************
> ' Automation Error - The Server Threw An Exception
> ' Run Time Error -2147417851
> ' Note - I have Triple Check the Path, It's Correct
> '************************************************
> Set objDoc = objword.Documents.Open(DocPath)
> '************************************************
>
> objDoc.Activate
> objword.Visible = True
>
> End Sub
.



Relevant Pages

  • Re: open word from excel...file does not exist error
    ... You might need a reference in the VB to Microsoft Word # Object ... Dim Word As Object ... Sub OpenAWordDoc() ...
    (microsoft.public.excel.programming)
  • Re: Copy from Excel to Word in VB
    ... Set a reference (Tools> References from the VBE menu) to "Microsoft Word ... Dim wdApp as Word.Application ...
    (microsoft.public.word.vba.general)
  • RE: open arguments.
    ... The original to add a complete new quote, one to edit a quote and one to ... Dim rst As Recordset ... This opens the form specified by stDocName in data entry mode and passes the ... You want to store your reference so poke it into the reference field. ...
    (microsoft.public.access.modulesdaovba)
  • RE: open arguments.
    ... Dim rst As DAO.Recordset ... Just realised there is an Access object called Reference. ... This opens the form specified by stDocName in data entry mode and passes the ...
    (microsoft.public.access.modulesdaovba)
  • RE: open arguments.
    ... Dim dbs As DAO.Database ... Dim rst As DAO.Recordset ... Just realised there is an Access object called Reference. ... This opens the form specified by stDocName in data entry mode and passes the ...
    (microsoft.public.access.modulesdaovba)