Link to home
Start Free TrialLog in
Avatar of PABenjamin
PABenjaminFlag for United States of America

asked on

Can I get the Permanent Attachment in Initial Emails, but not in Replies and Forwards?

BlueDevilFan helped me with a Macro in Outlook that permanently attached a PDF document to outgoing emails. It worked almost too well. The attachment appears in initial emails, but is also included in replies and forwards. Is there a way to edit the macro so that it doesn't include the attachment in replies and forwards?

Also, because it's a macro, in order to avoid getting the "Security Warning" I had to allow all macros to run. This, of course, is a potential security hole. Is there a way to allow this one macro to run, but prevent others from being allowed to run? The code used to run the "attachment" macro is included.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    If Item.Class = olMail Then
        'Edit the file path and name on the following line'
        Item.Attachments.Add "C:\MyFile.pdf"
        Item.Save
    End If
End Sub

Open in new window

SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PABenjamin

ASKER

Hi matthewspatrick,

Thanks. The first part, the adjustment to the code, worked. I'd like to attempt the second, using a self signed certificate, but I'm not sure of the best way to go about it. A step-by-step guide would be helpful. Just so you know; we're running Outlook 2003/Exchange 2003 (under Windows Server 2003 Std).
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You made me look like a star. I told the user I'd have the solution next week. Instead I have it the same day the problem was discovered! Way to go Patrick!
Glad to help :)