Results 1 to 4 of 4
  1. #1
    TOPSie is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    108

    pdf files in WebBrowser control

    I think I understand that this problem cannot be fixed as Access 2016 has embedded IE7 and we are not able to change that.
    So here is my problem. I have a table of transactions and one of the fields points to a pdf "picture" of the paper invoice received. I have code which opens the pdf file within a webbrowser control. I don't want to do anything else - just view the pdf .
    And my code WORKS, the pdf file is displayed within the control.
    BUT if I want to loop through a set of pdf files displaying each successifly then some work but some fail:-

    Click image for larger version. 

Name:	Clipboard01.jpg 
Views:	22 
Size:	9.6 KB 
ID:	50968

    Now I will have to live with this - since if I exit the loop and reenter then there is a chance that the pdf will display.
    I have tried putting a delay in the loop but it still fails - and it seems to be less prone to failure on my development machine than the production machine - which has very similar configurations??



    I would like to be able to trap this error message and just keep trying, rather than having to exit the loop and reenter.

    I have tried this code:

    Code:
    On Error GoTo PDFfail
        imgInvoice.Visible = False
        wbDisplayInvoice.Visible = True
        wbDisplayInvoice.ControlSource = "=""" & gPaperInvoiceFull & """"
    
    cmdOK.SetFocus
    Me.InsideHeight = wbDisplayInvoice.Top + wbDisplayInvoice.Height + 5000
    Exit Sub
    PDFfail:
    MsgBox "PDF Fails"
    but the "Fails" message never appears just the underlying message from wherever

    So anyone know how to trap this message please???????

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    That is not a VBA error though?
    You would get the same if you try and open a word document which is read only, the document does not open until you answer the word prompt?
    Might need to try and use Adobe automation to see if the file ipens first?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    TOPSie is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    108
    Yes I know it isn't Access - the question was "can it be trapped (in Access)?" and it seem tyhe answer is NO.
    Fair enough. I have added a botton to the form and if I get this edrror - after clicking OK in the error - I clear the webrowswer control and reload the form which refreshes it and this time it works. So some underlying resource (??) is reset and now it is OK
    Pain in the neck, but I can cope with it/

    Thanks

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Not sure what you want in the control source property, but shouldn't it be like
    """=" & gPaperInvoiceFull & """"

    Wondering if the property value is malformed (at least sometimes) and that's why the error. Always best to avoid errors if you can rather than trap them. But I doubt it's possible to get an Adobe error into Access unless you use vba that is designed to work with Adobe library (the automation suggestion).
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Key Press Enter on Webbrowser control
    By journeyman in forum Access
    Replies: 2
    Last Post: 08-30-2023, 05:17 PM
  2. Printing Image in Webbrowser control
    By WAVP375 in forum Access
    Replies: 0
    Last Post: 07-11-2018, 09:09 AM
  3. WebBrowser control requery
    By Historypaul in forum Forms
    Replies: 4
    Last Post: 11-12-2014, 09:09 PM
  4. WebBrowser Control to use Chrome?
    By kdbailey in forum Access
    Replies: 2
    Last Post: 07-15-2014, 11:30 AM
  5. sizing a url within a webbrowser control
    By Kirsti in forum Programming
    Replies: 4
    Last Post: 11-06-2012, 06: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