Posted to microsoft.public.excel.programming
|
|
Print referenced file
Thanks again, with those changes it is working just fine.
"Peter T" <peter_t@discussions wrote in message
...
Couple of other things you'll need to adapt in the example for VBA for the
error handling -
Change
dim sErr As Long (that must be a typo)
to
sErr As String
after
Else
' raise an appropriate error:
add
On Error Goto errH
change
Err.Raise lErr, , App.EXEName & ".GShell", sErr
to
Err.Raise lErr, , sErr
just before
End Function
add
Exit Function
errH:
MsgBox sFIle & vbCR & Err.Description
Regards,
Peter T
"Peter T" <peter_t@discussions wrote in message
...
There's a good example here
http://www.vbaccelerator.com/codelib/shell/shellex.htm
towards the bottom you'll see a sample of how to print, change "Me.Hwnd"
to 0&, or application.hwnd (in XL10+).
you might want to change
ShellExecuteForExplore(Owner, sOperation, sFIle, 0, 0, essSW_SHOWNORMAL)
to
ShellExecuteForExplore(Owner, sOperation, sFIle, 0, 0, essSW_HIDE)
Regards,
Peter T
|