Solved

WebBrowser in exe giving automation error

Posted on 2004-10-08
2
1,368 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
[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
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

Independent Software Vendors: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Basic Excel Formatting error 4 141
Modifying Conditional Format from VBA code 3 69
Added a column screws up code 5 69
Set email body to html using vbscript 6 71
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

749 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