Flag outgoing mail with pdf attachment

kryptonian

Board Regular
Joined
Oct 6, 2006
Messages
104
Hi! I need to setup a macro to flag outgoing emails with pdf attachment/s. How do I go about this? Here's what I've been playing with so far...

~~~~~~~~~~~~~

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

Dim atmt As Outlook.Attachment
Dim pdfcount As Integer
Dim intres As Integer

pdfcount = 1

For Each atmt In Outlook.Attachment
If Right(atmt.FileName, 3) = "pdf" Then
pdfcount = pdfcount + 1
End If
Next atmt

intres = MsgBox(pdfcount & " pdf attachments found.", vbYesNo)
If intres = vbNo Then
Cancel = True
End If

End Sub
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
how to enable this code. i ahve added this code in a module but it didnt work. am new to macros and VBA
 
Upvote 0

Forum statistics

Threads
1,225,613
Messages
6,186,003
Members
453,334
Latest member
Prakash Jha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top