Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Jan 2001
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Opening a Word Document (Office 97 SR-2)

    I

  2. #2
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Opening a Word Document (Office 97 SR-2)

    Jim,

    Here is some code to get you started:


    <font color=448800>'Dimension variables to hold pointers to the Word Application
    'Early Binding Dimensioning
    ' To use these declarations, reference the Word Object Library</font color=448800>
    Dim objWord As Word.Application

    <font color=448800>'Get pointer to Word Object
    ' Handle Error In-Line</font color=448800>
    On Error Resume Next
    Set objWord = GetObject(, "Word.Application")
    If Err.Number = 429 Then
    <font color=448800>'If we got an error, that means there was no Word Instance</font color=448800>
    Set objWord = CreateObject("Word.Application")
    End If

    <font color=448800>'Make Word Instance visible</font color=448800>
    objWord.Visible = True
    <font color=448800>'Reset Error Handler</font color=448800>
    On Error GoTo 0
    <font color=448800>'Open Document</font color=448800>
    objWord.Documents.Open "C:FullPathToDocument.doc"

    <font color=448800>'Release pointer to Word</font color=448800>
    set bojWord = Nothing
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Opening a Word Document (Office 97 SR-2)

    Another possibility is to use the ShellExecute WinAPI function. See <post#=166218>post 166218</post#> for an example.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •