Re: Auto Print email and word attachments on send

  • Thread starter ZGlhbW9uZGdhdG9yQGhvdG1haWwuY29t
  • Start date Views 2,058
Z

ZGlhbW9uZGdhdG9yQGhvdG1haWwuY29t

#1
> > Hi guys,
> > I have a created a standard template and would like it to print the e-mail
> > contents and the word attachements when I click send.
> > Any assistance would be greatly appreciated.


> You can modify this sample:
> http://www.vboffice.net/en/developers/print-attachments-automatically
> Instead of calling it from ItemAdd call it from the ItemSend event.
> Michael Bauer


Good Afternoon Michael,

I get a lot of attachments in PDF, DOC, XLS and JPG formats. I have the

software required to print each format. So I have attempted to use this

script but it is not working for me. I entered the script, then made a rule

that filtered it down to specific mailboxes (not my primary mailbox).

I don't believe I have edited it at all but here it is:

Private Sub PrintAttachments(oMail As Outlook.MailItem)

On Error Resume Next

Dim colAtts As Outlook.Attachments

Dim oAtt As Outlook.Attachment

Dim sFile As String

Dim sDirectory As String

Dim sFileType As String

sDirectory = "D:\Attachments\"

Set colAtts = oMail.Attachments

If colAtts.Count Then

For Each oAtt In colAtts

sFileType = LCase$(Right$(oAtt.FileName, 4))

Select Case sFileType

Case ".xls", ".doc"

sFile = ATTACHMENT_DIRECTORY & oAtt.FileName

oAtt.SaveAsFile sFile

ShellExecute 0, "print", sFile, vbNullString, vbNullString, 0

End Select

Next

End If

End Sub

Is there something else I need to do or am I missing something??

Thanks in Advance!!

Rich Webb



 

Similar threads

Top