Name of attachment in replies (HTML) - possible??

Not open for further replies.


Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
When replying to an email with an attachment, it is removed which is fine. But it would be very useful to have the name of the removed attachment inserted in the reply.

I think it works with RFT mails, but my organisation use HTML as standard.

Any way of doing this?

Hi Diane,

I am experiencing a problem after pasting the code into the VBA editor. I havent modified the code and have followed the instructions - I believe....

Beginning of my code looks like this (image attached/inserted).

Any clue how to fix it?

outlook vba editor.jpg
When I run from the editor, I get the error " Invalid attribute in Sub or Function" when getting to "Private WithEvents oExpl As Explorer".
make sure option explicit and the private withevents line are at the top.
Thanks! It works now and even utilises my default formatting.

Fine tune question: I would like the code to insert say 2 lines above the attachment name so I can start typing right away. I (think I) can see where to insert it, but what do I insert?
In the line where you put the filename string together (the webserver crashed so I can't check the code right now), you need to add vbcrlf or vblinefeeds.

strAtt = vbcrlf & vbcrlf & whatever is there now & "<<" ....

if the cursor is not set at the top we can add code such as in this sample - E-Mail: Set the cursor - to position it.
1) That is great, the 2 vbcrlf works. 2 lines inserted above attachment name.

2) I followed the link, and came up with this piece of code that I inserted as the last bit:
Dim Ins As Outlook.Inspector
Dim Doc As Word.Document
Dim Range As Word.Range
Dim Pos As Long
Set Ins = Application.ActiveInspector
Set Doc = Ins.WordEditor
If Not Doc Is Nothing Then
Pos = Doc.Range.Start
Set Range = Doc.Range(Pos, Pos)
End If

Sofar it seems to work!
Since you always want to be at the top, it should also work to use

Set Range = Doc.Range(0, 0)

That would reduce the code by oh, one line. :)
I only just now discovered that the code (in my hands) does not insert the name of all attachments to the original mail. Any easy solution to this?

Apart from that, it works very nicely.
If i recall, you put the CR in this part:

For Each oAtt In oItem.Attachments
If oAtt.Size > 5200 Then
strAtt = strAtt & "<<" & oAtt.FileName & ">> "
End If

Next oAtt

The code above should pick up all attachments over 5 KB. (to avoid signature icons)

This code adds the two CR and the string of file names:

strAtt = vbCrLf & vbCrLf & strAtt
olSelection.InsertBefore strAtt

Here, I get:

<<image001.gif>> <<Exceptions 23JAN2013.xls>
(there was a 3rd file, 3KB that it did not add, but the signature icon was larger than 5KB).
Thanks again!

I had this line in my code: strAtt = vbCrLf & vbCrLf & "<<" & oAtt.FileName & ">> "

After modifying accordiing to the above, it now works perfectly
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
C Code to move mail with certain attachment name? Does Not work Outlook VBA and Custom Forms 3
kkqq1122 How would I add Search for attachment name Outlook VBA and Custom Forms 3
D Forwarding email based on the attachment file type and specific text found on the attachment file name Outlook VBA and Custom Forms 1
geofferyh How to change the Attachment File Name? Outlook VBA and Custom Forms 1
Vijay Reply all by attachment name Using Outlook 10
Michael R Belleville Making an Attachment Name the Message Subject Using Outlook 2
A "untitled attachment" if file name contains eg. special character Using Outlook 1
peacepanda How to save attachment looking at the attachment name Outlook VBA and Custom Forms 1
J Need Help Extracting Email Content into Excel Specifically the Attachment Name Using Outlook 3
E Printing attachment name Using Outlook 3
D Outlook File Attachment Based on Contact Name Outlook VBA and Custom Forms 5
T How to find or display the sub-folder name for an Archive Search Using Outlook 10
M Outlook Macro to save as Email with a file name format : Date_Timestamp_Sender initial_Email subject Outlook VBA and Custom Forms 0
C Site name? Using Outlook 1
A rule name into message - how? Outlook VBA and Custom Forms 5
ill13 Prepend the user's computer name to the subject. Outlook VBA and Custom Forms 1
C Automatically Insert Recipient Name from To Field Outlook VBA and Custom Forms 4
P Automatic Greeting "Hello Name," when Reply All is clicked Outlook VBA and Custom Forms 1
O Filter-Query Builder-Description - what field name to use? Using Outlook 4
D ISOmacro to extract active mail senders name and email, CC, Subject line, and filename of attachments and import them into premade excel spread sheet Outlook VBA and Custom Forms 2
B Search and Find Email by Folder Name Outlook VBA and Custom Forms 2
icacream Outlook 2016 “Enter your user name and password for the following server.” Using Outlook 5
G VBA to save selected Outlook msg with new name in selected network Windows folder Outlook VBA and Custom Forms 1
R Capture Sender's Display name and Address Outlook VBA and Custom Forms 3
I 'quote marks' around email name Using Outlook 1
A Prepending Email Addrs with "Display Name <email>" Has Stopped Working Using Outlook 0
U Outlook 2016 Outlook 2016 sender name Using Outlook 1
C Macro to extract sender name & subject line of incoming emails to single txt file Outlook VBA and Custom Forms 3
D Outlook 2010 Outlook in Windows 10 keeps asking for user name and password repeatedly Using Outlook 14
glnz O365 - How to control whether my From name shows as "Dicky". Using Outlook 2
glnz O365 - How to send from acct 2 but showing email name from acct 1 as From - alias? Using Outlook 0
Terry Sullivan Sender's Name Doesn't Appear in the From Field on Outlook 365/IMAP Using Outlook 2
Terry Sullivan Sender Field Displays My E-Mail Address, Not My Name Using Outlook 1
L Email with correct To address but displaying name of a related person Using Outlook 0
M Automatically add senders first name to a greeting Outlook VBA and Custom Forms 1
D Is a sub folder under contacts necessary to be able to name an Address Book? Using Outlook 1
icacream Enter your user name and password for the following server. Using Outlook 4
B Extracting email addresses from a folder - how to also get the name of the person the address is for? Using Outlook 5
I Saving attachments from multiple emails and updating file name Outlook VBA and Custom Forms 0
D Add date next to day name in Outlook Today calendar view Using Outlook 1
J Is it no longer possible to suppress Outlook 2019 Invalid Certificate name mismatch security alert via Registry? Using Outlook 1
R Search/Jump to a folder by typing its name Outlook VBA and Custom Forms 1
C Outlook Autocomplete suggestions showing wrong person's name against an email address Using Outlook 0
Nadine Rule to move attachments with specific name Outlook VBA and Custom Forms 1
B Looking to get the Recipient email address (or even the "friendly name") from an email I am replying to using VBA Outlook VBA and Custom Forms 4
J VBA Outlook : Subject line : Cut and Paste name to heading , number to very end of the body of Email Outlook VBA and Custom Forms 1
CWM030 Name Server's Exchange Server Administration 15
CWM030 Name Change? Exchange Server Administration 9
W Save and rename outlook email attachments to include domain name & date received Outlook VBA and Custom Forms 4
V not able to change name in customize Ribbon Outlook VBA and Custom Forms 1

Similar threads