Zhavlajujem, radi. Majstor je majstor :-)
Code:
Function Open_PDF_Page(strPath As String, intPageNum As Long) As Boolean
'---------------------------------------------------------------------------------------
' Procedure : Open_PDF_Page
' Author : Zidar, uz pomoc Z.Eremije
' Date : 04-Oct-2012
' Purpose : Opens PDF file, given as strPath, na page intPageNum
' Based on : http://wwwimages.adobe.com/www...t/pdfs/pdf_open_parameters.pdf
'
' Example: ? Open_PDF_Page(strPath:="J:\DI\REceivedFromVendor\isr_36e_001.pdf",intPageNum:=5)
'---------------------------------------------------------------------------------------
'
Dim strReader As String
Dim strShell As String
'Loaction of Adobe Exe, i ovo bi mogao da bude parametar
On Error GoTo Open_PDF_Page_Error
'this should eb paremtrized as well!
strReader = "C:\Program Files (x86)\Adobe\Acrobat 10.0\Acrobat\Acrobat.exe /A"
'This works, but no page 4:
'strShell = """" & strReader & """ /A ""page=" & intPageNum & """ """ & strPath & """"
'This works and opens the document on given page:
strShell = strReader & " page=" & CStr(intPageNum) & " " & """" & strPath & """"
Debug.Print "strShell: " & strShell
Shell strShell, vbNormalFocus
EXIT_HERE:
On Error Resume Next
Exit Function
Open_PDF_Page_Error:
Select Case Err
Case Else
MsgBox "Error " & Err.Number _
& " (" & Err.Description _
& ") in procedure Open_PDF_Page of Module modOpenPDF"
End Select
Resume EXIT_HERE
End Function
Function Open_PDF_Search(strPath As String, strSearch As String) As Boolean
'----------------------------------------------------------------------------------------------------------------------
' Procedure : Open_PDF_Search
' Author : Zidar, uz pomoc Z.Eremije
' Date : 04-Oct-2012
' Purpose : Open PDF given as strPath, on position given as strSearch
' Based on : http://wwwimages.adobe.com/www...t/pdfs/pdf_open_parameters.pdf
'
' Example: Open_PDF_Search(strPath:="J:\DI\REceivedFromVendor\isr_36e_001.pdf",strSearch:="442-427-365")
'----------------------------------------------------------------------------------------------------------------------
'
Dim strReader As String
Dim strShell As String
'Loaction of Adobe Exe
On Error GoTo Open_PDF_Search_Error
'Again, hardcodded path for Adobe, not good, should be parametrized
strReader = "C:\Program Files (x86)\Adobe\Acrobat 10.0\Acrobat\Acrobat.exe /A"
'This works and opens for given search:
'strShell: C:\Program Files (x86)\Adobe\Acrobat 10.0\Acrobat\Acrobat.exe /A "zoom=50&navpanes=1=OpenActions&search=276-910-395" J:\DI\Grade 3 and Grade 6\Gr3&6 - 2011-2012\Reporting\ISR\REceivedFromVendor\5Sept2012\isr_36e_001.pdf
'strShell = strReader & " " & """" & "zoom=75&navpanes=1=OpenActions&search=" & strSearch & """" & " " & strPath
strShell = strReader & " " & """" & "zoom=75&navpanes=1=Actions&search=" & strSearch & """" & " " & strPath
Debug.Print "strShell: " & strShell
Shell strShell, vbNormalFocus
EXIT_HERE:
On Error Resume Next
Exit Function
Open_PDF_Search_Error:
Select Case Err
Case Else
MsgBox "Error " & Err.Number _
& " (" & Err.Description _
& ") in procedure Open_PDF_Search of Module modOpenPDF"
End Select
Resume EXIT_HERE
End Function