Results 1 to 6 of 6
  1. #1
    TerraEarth is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    86

    Error coding for AVDoc.Open()

    When Utilizing AVDoc.Open(), it returns a Boolean depending on whether a pdf document was able to be opened or not.


    When the PDF document is not opened it returns False but this also pops up from Adobe:

    Click image for larger version. 

Name:	error.png 
Views:	11 
Size:	9.4 KB 
ID:	34316

    I was wondering if there was a way to error-code this popup away via, because the program essentially freezes until I first go to my Adobe window and then exit out of the above adobe error prompt. Any suggestions? Below is what my code for this looks like currently:

    This utilizes the Adobe Acrobat 10.0 Type Library in Access 2016:

    Code:
    Sub
    
    Dim Condition As Boolean
    Dim PDFDirectory As String
    
    Condition = False
    PDFDirectory = "C:\Users\Me\ADirectory\ABlankPDFFile.pdf"
    Set AcrobatApplication = CreateObject("AcroExch.App")
    Set AVDoc = CreateObject("AcroExch.AVDoc")
    
    While (Not Condition)
     If AVDoc.Open(MasterPDF, "") Then
     'Do whatever I need to do
     Condition = True
     Else
          If MsgBox("Master PDF not Found, please make sure that the PDF -NameOfPdf- is in the right directory: ___w/e the directory is____"  vbOkCancel) = vbCancel Then
     Exit Sub
     Else
    Wend
    
    End Sub

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Not familiar with that type library, but when using automation with Excel, the Excel library has a property of the application object that turns off screen updating and system prompts for saving or not. Did you search the pdf library for any similar property or method?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    TerraEarth is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    86
    This actually isn't a excel automation, this is a modified clip of code straight from my accdb. If you're talking about whether or not I have the PDF set to display (i.e. Show), etc. I have all of those disabled already, my main issue is when the PDF directory is wrong or there's no file in the designated directory to open a PDF from. This causes a popup to come up from a different window (adobe acrobat) and requires users to switch windows and 'ok' the error message before the access vba can kick off again.

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    I understood that. I was only using Excel as an example and asking if you looked for similar properties for Adobe.

  5. #5
    TerraEarth is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    86
    Ah, I see. Yes I have looked for similar properties in Adobe but was unable to find one. There are similar features with hiding processes from the user but I am hoping to find something to expedite the switching between tabs issue. If I was the one using the database, I personally would never have any issues with this but I can imagine plenty of people would when using this. I am still looking for methods to resolve this issue, as this isn't the worst problem so I did put it on the back-burner but I do plan on poring through the documentation more thoroughly to see if there's a solution included in the library or if there's perhaps some other workaround.

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    I guess you're using the SDK (specifically IAC API)? I don't have it or AcrobatExchange installed, otherwise I'd take a look for you. Pretty sure it doesn't work with Reader, which you no doubt know. The only thing that looks a bit suspect is that you don't seem to have declared AcrobatApplication or AVDoc. Maybe you have them at the module level.
    Good luck!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 07-12-2017, 04:29 PM
  2. Replies: 10
    Last Post: 09-08-2014, 06:07 PM
  3. Replies: 4
    Last Post: 10-10-2013, 01:59 PM
  4. Error - The expression On Open...
    By apsf68 in forum Access
    Replies: 2
    Last Post: 11-23-2011, 12:18 PM
  5. Error Coding Problems
    By desk4tbc in forum Programming
    Replies: 7
    Last Post: 07-11-2011, 04:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums