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

PABenjaminAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Patrick MatthewsCommented:
Try this quick and dirty way to shortcircuit replies and forwards:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    If Item.Class = olMail Then
        Select Case UCase(Left(Item.Subject, 2))
            Case "FW", "RE"
                'do nothing
            Case Else
                'Edit the file path and name on the following line'
                Item.Attachments.Add "C:\MyFile.pdf"
                Item.Save
        End Select
    End If
End Sub
0
Patrick MatthewsCommented:
As for the security question, you could try "signing" your code.  A real digital certificate costs money.  If this
is just for yourself, you could try using selfcert to sign your code.  If you need real security this is not the
answer, as selfcert can be spoofed.
0
PABenjaminAuthor Commented:
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).
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Patrick MatthewsCommented:
PABenjamin,

This should get you started:
http://support.microsoft.com/kb/217221
http://www.howto-outlook.com/howto/selfcert.htm

Regards,

Patrick
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PABenjaminAuthor Commented:
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!
0
Patrick MatthewsCommented:
Glad to help :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Outlook

From novice to tech pro — start learning today.