[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 730
  • Last Modified:

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

0
PABenjamin
Asked:
PABenjamin
  • 4
  • 2
3 Solutions
 
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 new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
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
 
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

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now