• Opening a PDF file from Word (Word 97)

    Author
    Topic
    #384317

    I am wanting to open a file (a reference document) that is a PDF, from a word template. I know that I have to open Adobe first, and tried the following lines… but I’m not quite right….

    ChangeFileOpenDirectory _
    “C:Program FilesAdobeAcrobat 4.0AcrobatAcrobat.exe/C:Program FilesMicrosoft OfficeTemplatesCIS TEMPLATESref”
    Documents.Open FileName:=”IS_DataModel_Guidelines.pdf”, ConfirmConversions:= _

    Help!

    Viewing 0 reply threads
    Author
    Replies
    • #658900

      You don’t have to open Acrobat Reader first. You can open a .pdf document with

      ActiveDocument.FollowHyperlink “C:MyDocsTest.pdf”

      or by using ShellExecute. ShellExecute provides the equivalent of opening (or printing) a file in Windows Explorer.

      To use it, put the following code in a standard module:

      Private Declare Function ShellExecute Lib “shell32.dll” Alias “ShellExecuteA” _
      (ByVal hwnd As Long, _
      ByVal lpOperation As String, _
      ByVal lpFile As String, _
      ByVal lpParameters As String, _
      ByVal lpDirectory As String, _
      ByVal nShowCmd As Long) As Long

      Private Const SW_SHOWMAXIMIZED As Long = 3

      To use it, call it like this:

      Dim lngResult As Long

      lngResult = ShellExecute(0&, “Open”, _
      “C:MyDocsTest.pdf”, 0&, 0&, SW_SHOWMAXIMIZED)
      If lngResult <= 32 Then
      MsgBox "Couldn

      • #658909

        AWESOME… IT worked! What a pick-up to a day that has been deadends!

    Viewing 0 reply threads
    Reply To: Opening a PDF file from Word (Word 97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: