Solved

WebBrowser in exe giving automation error

Posted on 2004-10-08
2
1,346 Views
Last Modified: 2013-12-26
Hi,

I'm new to this area...
I've got this VB code to work perfectly, but when saved to an exe, the file gives this error:

"Run-time error '-2147221248 (80040100)'
Automation error
Trying to revoke a drop target that has not been registered"

On the MSDN site, it says this is by design.  Is there any work around?  (I already tried using:
 While WebBrowser1.QueryStatusWB(OLECMDID_PRINT) <> OLECMDF_SUPPORTED And OLECMDF_ENABLED
-Wend loop before going to print and it just hung VB up)

Here is my code so far:

Private Sub Form_Load()
    WebBrowser1.Navigate ("http://www.mysql.com")
End Sub

Private Sub Timer1_Timer()
    WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER
    WebBrowser1.Stop
    Unload Me
End Sub


Thanks!
0
Comment
Question by:LTY83
2 Comments
 
LVL 26

Accepted Solution

by:
EDDYKT earned 500 total points
ID: 12261763
Try this, add two timers and 1 webbrowser to your form


Option Explicit

Private Sub Form_Load()
Timer1.Interval = 1
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
Timer1.Enabled = False
WebBrowser1.Navigate "http://www.mysql.com"
End Sub

Private Sub Timer2_Timer()
Timer2.Enabled = False
Unload Me
End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Debug.Print pDisp
If (pDisp = WebBrowser1) Then
WebBrowser1.ExecWB 6, 2, 0, 0
Timer2.Interval = 3000
Timer2.Enabled = True
End If
End Sub
0
 
LVL 4

Author Comment

by:LTY83
ID: 12262247
Worked just like I had wanted! Thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

863 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now