PDA

View Full Version : Vista Runtime error when printing Internet Explorer window



j.smith1981
09-23-2009, 06:18 AM
I am having problems wanting to print a HTML page with no prompt in Vista, works fine in XP.

Here's the code to make it print:

Const OLECMDID_PRINT = 6
Const OLECMDEXECOPT_PROMPTUSER = 1
Const OLECMDEXECOPT_DONTPROMPTUSER = 2

Dim IE As Object


'Sets ie as the object reference
Set IE = CreateObject("internetexplorer.application") ' Creates a new object if above is true

'Makes Internet Explorer visible
IE.Visible = True ' Make sure its worked!

IE.Navigate "http://mywebpage.com"

'Wait for page to load completely!
While IE.Busy
DoEvents 'wait until IE is done loading page.
Wend

'Command to print
IE.OLECMDID_PRINT , OLECMDEXECOPT_DONTPROMPTUSER ' CAUSES PROBLEMS IN VISTA

Any ideas of how to get around this, I am using Excel 2007.

Any help would be wonderful.

Thanks,
Jeremy