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.
qandryAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.