Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 898
  • Last Modified:

PrintTemplateInstantiation as webbrowser trigger

I am connecting to a website that generates data That I wish to collect.
After having fed in the data and performed the necessary calculations a Print button appears.
I succesfully used sendkeys  to select and copy the screen to a file for filtering and saving, which usually works but is not in the least elegant as I have to cancel the print dialog that is autmatically generated and then call on my own procedure.
I've come across an event in webrowser ".PrintTemplateInstantiation" which is definitely triggered after clicking the print button.

The question: How could I use PrintTemplateInstantiation = True to cancel the generation of the print dialog box.

This question is probably worth a lot more than the 80 points I have to spend. If so please advise of same and I shall have to postpone the question untill I can earn my way.
0
qandry
Asked:
qandry
  • 3
  • 3
1 Solution
 
qandryAuthor Commented:
Please note I have posted this question under programming by mistake it had a point value of 80 points. Ive posted it here with a more realistic 200 points.

How can I delete this question from the programming heading ?
My deepest apologies for starting with so much confusion.
0
 
Richie_SimonettiIT OperationsCommented:
Could you post the url?
Regarding second, just ask to community support to delete it or put a comment with a link to this one.
0
 
qandryAuthor Commented:
Richie the url is www.foodstandards.gov.au/npc/anzfa_npc/
You would need to
1/ search for an ingredient ie 'honey'
2/ select one of the results
3/ nominate a recipe name
4/ click add ingredient
5/ then nominate final weight and serve size.
6/ click calculate
7/ finally PRINT. " it is this that I wish to capture and cancel.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Richie_SimonettiIT OperationsCommented:
Option Explicit

Dim iedoc As HTMLDocument
Dim WithEvents btn As HTMLInputButtonElement

Private Function btn_onclick() As Boolean
MsgBox "got it!"
End Function

Private Sub Form_Load()
WB1.Navigate "http://www.foodstandards.gov.au/npc/anzfa_npc/index.cfm?fuseaction=DisplayDefault&CFID=71742&CFTOKEN=25407887"

End Sub

Private Sub WB1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If (pDisp Is WB1.Object) Then
    Set iedoc = WB1.Document
    Dim i As HTMLInputButtonElement
   
    For Each i In iedoc.body.All
        If TypeOf i Is IHTMLInputButtonElement Then
            If InStr(1, i.Value, "Print results", vbTextCompare) Then
                Set btn = i
                Exit For
            End If
        End If
    Next
   
End If
End Sub

0
 
qandryAuthor Commented:
Thanks Richie,
I thouht you would have the answer. I had already seen your code for capturing controls on a web page and thought it could work.
What I don.t understand is how
-
Private Function btn_onclick() As Boolean
MsgBox "got it!"
End Function
-
does this manage to interupt the predefined function of the button?
I had hoped to stop at the document produced upon the pressing of the print button but avoid the automated print dialog box appearing, but I can get all the data i need at this current point. Thank you
0
 
Richie_SimonettiIT OperationsCommented:
"...does this manage to interupt the predefined function of the button?..."
Yes, you are switch the "real" event with yours.
It is similar of how to avoid right click on a web page and use your own menu instead of default one.

You could see it at http://www.angelfire.com/realm/vb-shared/IE_WB_DOM_tips.htm

Thanks for "A" grade.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now