?
Solved

PrintTemplateInstantiation as webbrowser trigger

Posted on 2003-03-23
6
Medium Priority
?
884 Views
Last Modified: 2007-12-19
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
Comment
Question by:qandry
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 

Author Comment

by:qandry
ID: 8189630
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
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 8189806
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
 

Author Comment

by:qandry
ID: 8194271
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
Industry Leaders: 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!

 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 800 total points
ID: 8194744
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
 

Author Comment

by:qandry
ID: 8195516
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
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 8195641
"...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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month14 days, 7 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question