PDF and VBA Code Help (1 Viewer)

bonekrusher

Registered User.
Local time
Today, 10:22
Joined
Nov 19, 2005
Messages
266
Hi All,

I have a code which uses the Adobe OLE. It works great, but I want to know how to open the PDF to a page number using the "gotopage".

Any one know how to do this?

Code:
Private Sub Command5_Click()


'Dim avCodeFile As CAcroAVDoc
Set Acroapp = CreateObject("AcroExch.App")
Acroapp.Show
Set avCodeFile = CreateObject("AcroExch.AVDoc") 'This is the code file
avCodeFile.Open "c:\temp\mom.pdf", "Code File"

End Sub
 

bonekrusher

Registered User.
Local time
Today, 10:22
Joined
Nov 19, 2005
Messages
266
Solved

I have a text field called "jumpto" which allows user to enter a page number to go to. I attached the following code to a Button Click event...

Here it is:


Code:
 Dim AcroApp As CAcroApp
    Dim AVDoc As CAcroAVDoc
    Dim PDDoc As CAcroPDDoc
    Dim mypath As String
    Dim mystring As String
    Dim pg As Integer
    
 
     'you'll need to change this to an existing pdf file on your system
    mypath = "c:\yourfile.pdf"
     
    Set AcroApp = CreateObject("AcroExch.App")
    Set AVDoc = CreateObject("AcroExch.AVDoc")
     
    AVDoc.Open mypath, ""
    Set PDDoc = AVDoc.GetPDDoc
     
    If IsNull(Me.Jumpto) Then
    MsgBox ("enter a page to jump to")
    Else:
        pg = Me.Jumpto - 1
    'mystring = Me.findme 'InputBox("Enter text to search for:", "PDF Search")
    'AVDoc.FindText mystring, 0, 0, 0
    AVDoc.GetAVPageView.GoTo pg 'put whatever page you wanna goto there but keep in mind
' that page 1 is 0
    AcroApp.Show
 

Users who are viewing this thread

Top Bottom