Hi,

Since you can get the print to work from a separate button the problem
is probably that the page hasn't loaded when you are trying to print.
You could do one of 2 things... wait in a loop until the control is
ready or print from one of the NavigateComplete events.

There is a way to test the control to see if it is ready to print but
I can't remember the code and don't have it with me at work. I'll post
a follow-up from home that shows how to implement a loop that waits
for the printer to be ready before printing.

Hope this helps.

Thanks,
Dave.

[EMAIL PROTECTED] (John) wrote in message news:<[EMAIL PROTECTED]>...
> I have embedded a Moz control in my VB6 application. I would like to
> programmatically load a page and print it (without user intervention).
> However, whenever I try to print, I get the following error: "Method
> 'ExecWB' of object 'IWebBrowser2' failed". I've noticed a lot of other
> people complaining about this problem but haven't seen any solutions.
> 
> It's interesting to note that I *can* print if I have TWO buttons that
> a user clicks - one to navigate and one to print. If there is only one
> button to do both, printing fails with the same error. I tried put a
> delay in between navigating and printing but that didn't seem to make
> a difference in my (single-threaded) application. It's also
> interesting to note that the 2-button method works only when I run
> from a compiled version of the software - if I try to run it from
> within the VB debugger (and I use that term loosely) it fails again
> with the same error.
> 
> Anyone have any experience with this or ideas? Thank you for time,
> I've been trying unsuccessfully to get this to work for a while now.
> 
> sample code:
> MozillaBrowser1.Navigate2 ("file:///F:/file.html")
> MozillaBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,
> "", ""
> 
> Thanks!
> 
> John
>

Reply via email to