Results 1 to 3 of 3

Thread: Opening pdf document-word VBA

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2008
    Posts
    31

    Opening pdf document-word VBA

    Hi all,

    I have a pdf document in a specified path. I want to open that pdf document using VBA code. Please advise.

    Thanks,
    Senthil. S

  2. #2
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Opening pdf document-word VBA

    Try this...

    vb Code:
    1. Sub OpenPDF()
    2.     Dim AcroApp As CAcroApp, AVDoc As CAcroAVDoc
    3.     Dim PDDoc As CAcroPDDoc, MyFilePath As String
    4.     Dim mystring As String, MyPage As Long
    5.      
    6.     '~~> Change this to an existing pdf file on your system
    7.     MyFilePath = "c:\Temp.pdf"
    8.      
    9.     Set AcroApp = CreateObject("AcroExch.App")
    10.     Set AVDoc = CreateObject("AcroExch.AVDoc")
    11.      
    12.     AVDoc.Open MyFilePath, ""
    13.     Set PDDoc = AVDoc.GetPDDoc
    14.    
    15.     '~~> Navigate to a specific page
    16.     If IsNull(Me.Jumpto) Then
    17.         MsgBox ("enter a page to jump to")
    18.     Else:
    19.         MyPage = Me.Jumpto - 1
    20.    
    21.     AVDoc.GetAVPageView.GoTo MyPage
    22.     AcroApp.Show
    23. End Sub
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2008
    Posts
    31

    Re: Opening pdf document-word VBA

    Dear Koolsid,

    Thanks for your reply. To execute the code can you please mention what are the references i need to include.

    Thanks,
    Senthil. S

Posting Permissions

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



Click Here to Expand Forum to Full Width