Open e-mail attachment

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to have outlook open a word attachment, print the file, then
close?

Any help is greatly appreciated.

Thx again.

Tim
 
Tim, first you need to save the attchment to the file system. Then you
can use a Win32 API for printing. Sample:

Private Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Const SW_HIDE = 0

Public Function PrintFile(sFile As String, _
Optional lHwnd As Long _
) As Boolean
PrintFile = CBool(ShellExecute(lHwnd, "print", sFile, vbNullString,
vbNullString, SW_HIDE))
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top