E
Ed from AZ
I'm on XPpro, IE6sp2. I'm trying to use a VBA macro in Word 2003 to
open files in an instance of IE and print the file. I was hoping to
use a bit of JavaScript to accomplish the printing. I've searched a
lot of newsgroups and other sites, but can't get a handle on this.
I'm using IE because I have files of a type not easily handled by VBA,
but will open in IE.
In another VBA code (this one from Excel 2003), I ran some JavaScripts
using syntax like:
Dim strMax As String
strMax =
"javascript:moveTo(0,0);resizeTo(screen.availWidth,screen.availHeight-20)"
Call docIE.ParentWindow.execScript(strMax, "JavaScript")
The code I am currently using is:
Dim objIE As Object
Dim docIE
Dim winIE
On Error GoTo EndMe
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate "C:\Documents and Settings\UserName\Desktop\MyFile.pdf"
objIE.Visible = True
Set docIE = objIE.Document
Stop
Set winIE = docIE.ParentWindow
winIE.Print
But this errors at trying to set the winIE object, which would make it
pretty difficult to use the .execScript() method.
Any suggestions?
Ed
open files in an instance of IE and print the file. I was hoping to
use a bit of JavaScript to accomplish the printing. I've searched a
lot of newsgroups and other sites, but can't get a handle on this.
I'm using IE because I have files of a type not easily handled by VBA,
but will open in IE.
In another VBA code (this one from Excel 2003), I ran some JavaScripts
using syntax like:
Dim strMax As String
strMax =
"javascript:moveTo(0,0);resizeTo(screen.availWidth,screen.availHeight-20)"
Call docIE.ParentWindow.execScript(strMax, "JavaScript")
The code I am currently using is:
Dim objIE As Object
Dim docIE
Dim winIE
On Error GoTo EndMe
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate "C:\Documents and Settings\UserName\Desktop\MyFile.pdf"
objIE.Visible = True
Set docIE = objIE.Document
Stop
Set winIE = docIE.ParentWindow
winIE.Print
But this errors at trying to set the winIE object, which would make it
pretty difficult to use the .execScript() method.
Any suggestions?
Ed