View Single Post
Old 10-10-2008   #7 (permalink)
Dudely


 
 

Re: How to print a web page with VBA?

On Oct 9, 9:55*pm, "mayayana" <mayaXXy...@xxxxxx> wrote:
Quote:

> I haven't tested this, but I think it should work:
>
> obIe.ExecWB 6, 0
>
> * *You should also make sure the page is fully loaded
> before calling it:
>
> *Do Until obIe.ReadyState = 4
> *Loop
>
>
>
Quote:

> > With VBA, I do something like the following:
>
Quote:

> > Set obIe = CreateObject("InternetExplorer.Application")
> > obIe.navigate (URLaddress)
>
Quote:

> > The page loads, and now I want to print the page.
>
Quote:

> > I've tried:
> > obIe.print
> > me.print
> > printer.print
> > obIe.document.print
>
Quote:

> > and some others. *Nothing I've tried works. *Does anyone know the
> > correct way to do this?
>
Quote:

> > Thank you in advance.- Hide quoted text -
>
> - Show quoted text -
For whatever reason the loop code doesn't seem to work, instead I use
a sleep 5000. It may have to do with the fact that I'm using the
Click and Onclick methods (when I posted, I simplified so as not to
confuse the real issue of needing to print), I really don't know and
don't care about that at the moment, I do know the page is fully
loaded, because I'm stepping through it and I don't move on until the
page is done.

The real issue: Your code works! Well, partially. It prints the
first page, but not the second. There are only 2 pages. The second
page is all images. For my purposes it's not absolutely critical that
I get the second page, however it would be nice. Any ideas why it
stops after the first page? In fact, I now notice that on the printed
page it says "Page 1 of 1", so it doesn't even recognize that there's
more than one page. Or perhaps 1 very long page?

Thank you again
My System SpecsSystem Spec