clif
08-29-2023, 10:11 PM
Could anyone help to see why i cannot printout! Thanks!
Call AcroAVDoc.PrintPages(0, pageNo, 2, 1, 1) is not working!
Sub Checkfigures()
Application.ScreenUpdating = False
Dim searchString As String
Dim blnSearch As Boolean
Dim AcroApp As Acrobat.CAcroApp
Dim AcrobatDoc As Acrobat.CAcroPDDoc
Dim AcroAVDoc As Object
Dim pageNo As Integer
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Sheet2")
Dim a As Integer
Set AcroApp = Nothing
Set AcrobatDoc = Nothing
Set AcroAVDoc = Nothing
Set AcroApp = CreateObject("AcroExch.App")
Set AcrobatDoc = CreateObject("AcroExch.PDDoc")
AcroApp.Show
AcrobatDoc.Open (ws.Cells(1, 1).Value)
Set AcroAVDoc = AcrobatDoc.OpenAVDoc("")
For a = 2 To 6
searchString = ws.Cells(a, 4).Value
blnSearch = AcroAVDoc.FindText(szText:=searchString, _
bCaseSensitive:=False, _
bWholeWordsOnly:=True, _
bReset:=2)
Set pdDoc = AcroAVDoc.GetPDDoc()
Set jso = pdDoc.GetJSObject
pageNo = jso.pageNum
Call AcroAVDoc.PrintPages(0, pageNo, 2, 1, 1)
Next a
AcrobatDoc.Close
AcroApp.CloseAllDocs
AcroApp.Exit
Application.ScreenUpdating = False
End Sub
Call AcroAVDoc.PrintPages(0, pageNo, 2, 1, 1) is not working!
Sub Checkfigures()
Application.ScreenUpdating = False
Dim searchString As String
Dim blnSearch As Boolean
Dim AcroApp As Acrobat.CAcroApp
Dim AcrobatDoc As Acrobat.CAcroPDDoc
Dim AcroAVDoc As Object
Dim pageNo As Integer
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Sheet2")
Dim a As Integer
Set AcroApp = Nothing
Set AcrobatDoc = Nothing
Set AcroAVDoc = Nothing
Set AcroApp = CreateObject("AcroExch.App")
Set AcrobatDoc = CreateObject("AcroExch.PDDoc")
AcroApp.Show
AcrobatDoc.Open (ws.Cells(1, 1).Value)
Set AcroAVDoc = AcrobatDoc.OpenAVDoc("")
For a = 2 To 6
searchString = ws.Cells(a, 4).Value
blnSearch = AcroAVDoc.FindText(szText:=searchString, _
bCaseSensitive:=False, _
bWholeWordsOnly:=True, _
bReset:=2)
Set pdDoc = AcroAVDoc.GetPDDoc()
Set jso = pdDoc.GetJSObject
pageNo = jso.pageNum
Call AcroAVDoc.PrintPages(0, pageNo, 2, 1, 1)
Next a
AcrobatDoc.Close
AcroApp.CloseAllDocs
AcroApp.Exit
Application.ScreenUpdating = False
End Sub