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

Status
Not open for further replies.

Viggo_L

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

Thanx!
 

Viggo_L

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
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
 

Viggo_L

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
When I run from the editor, I get the error " Invalid attribute in Sub or Function" when getting to "Private WithEvents oExpl As Explorer".
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
make sure option explicit and the private withevents line are at the top.
 

Viggo_L

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
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?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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.
 

Viggo_L

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
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)
Range.Select
End If

Sofar it seems to work!
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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. :)
 

Viggo_L

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
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.
 

Forum Admin

Senior Member
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).
 

Viggo_L

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Thanks again!

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

After modifying accordiing to the above, it now works perfectly
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
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
B Outlook - Printing - RTF Email Attachment Icon and Name Problems. Using Outlook 2
D Outlook File Attachment Based on Contact Name Outlook VBA and Custom Forms 5
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 1
glnz O365 - How to send from acct 2 but showing email name from acct 1 as From - alias? Using Outlook 1
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 5
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
C Changed By field not displaying individual user's name in O365 Shared Mailbox Using Outlook 9
I How to display sender's name instead of email address in outlook 2013 message Using Outlook 5
L Automatically Insert Recipient Name from To Field Outlook VBA and Custom Forms 33
soadfan Outlook rules look up display name only Using Outlook 4
J reinstalling Outlook 2007 asking for user name & password Using Outlook 14
J Outlook Rules - Changing auto-submit address in multiple rules, according to rule name Outlook VBA and Custom Forms 0
A saving attachement to folder named the same as rule name Outlook VBA and Custom Forms 0
D Inserting sender name and address with vba Outlook VBA and Custom Forms 1
A Error: The name cannot be matched to a name in the address list Using Outlook.com accounts in Outlook 0
tjd189 outlook 2016 name change Using Outlook 1
D Office365 Conference Room name change? Using Outlook 5
R Macro to check file name with outlook address book Outlook VBA and Custom Forms 0
C Changing the name of Outlook Messages saved to a folder Using Outlook 1
C Auto subject,name,email,deferred Using Outlook 2
D Change sender name outlook vba 2010 Custom Userform Outlook VBA and Custom Forms 1
A Get shared calendar name or id in custom appointment form Using Outlook 0

Similar threads

Top