Consulting

Results 1 to 5 of 5

Thread: Why cannot print PDF

  1. #1
    VBAX Contributor
    Joined
    Nov 2009
    Posts
    114
    Location

    Why cannot print PDF

    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
    Last edited by clif; 08-29-2023 at 11:37 PM.

  2. #2
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,059
    Location
    Hello Clif, you suggested that Call AcroAVDoc.PrintPages(0, pageNo, 2,1,1) is not working but supplied the code for the Sub CheckFigures module. Within that module you call the sub routine AcroAVDoc.PrintPages(0,2,1,1). Which sub routine is causing the issue?
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  3. #3
    VBAX Regular
    Joined
    Sep 2023
    Posts
    97
    Location
    From what I can see this line
    Call AcroAVDoc.PrintPages(0, pageNo, 2, 1, 1)
    should be
    AcroAVDoc.PrintPages(0, pageNo, 2, 1, 1)
    you don't need to use Call there as that is for transferring control to subprocedures and not methods of objects.

  4. #4
    VBAX Contributor
    Joined
    Nov 2009
    Posts
    114
    Location
    Quote Originally Posted by jdelano View Post
    From what I can see this line
    Call AcroAVDoc.PrintPages(0, pageNo, 2, 1, 1)
    should be
    AcroAVDoc.PrintPages(0, pageNo, 2, 1, 1)
    you don't need to use Call there as that is for transferring control to subprocedures and not methods of objects.
    It show error, how to solve it

  5. #5
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,059
    Location
    I'm guessing that when you set this
    .Set AcroAVDoc = AcrobatDoc.OpenAVDoc("")
    . Does it hold a value?
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Posting Permissions

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