Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-01-2017, 06:00 AM
AndyDDUK AndyDDUK is offline Rename attachment based on attachment name Windows 7 64bit Rename attachment based on attachment name Office 2010 64bit
Advanced Beginner
Rename attachment based on attachment name
 
Join Date: Oct 2012
Posts: 32
AndyDDUK is on a distinguished road
Default Rename attachment based on attachment name

Hi



I've receive multiple attachments on an email.

Some of these contain a date in the file name.

What is the code to modify the below, to take eg the first 5 characters in the file name?

Eg to save an attachment with a file name of "ABCDE_01032017.xls" as "ABCDE.xls" ?


Public Sub Save_APPS(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "P:\Data\"


For Each objAtt In itm.Attachments

If InStr(objAtt.DisplayName, ".xls") Then

objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName

End If
Set objAtt = Nothing

Next
End Sub

Office 2013 FYI not 2010 as stated in profile

May thanks
Andy
Reply With Quote
  #2  
Old 03-01-2017, 07:32 AM
gmayor's Avatar
gmayor gmayor is offline Rename attachment based on attachment name Windows 10 Rename attachment based on attachment name Office 2016
Expert
 
Join Date: Aug 2014
Posts: 3,966
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

See duplicate post
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rename attachment based on attachment name AndyDDUK Outlook 1 03-01-2017 07:31 AM
Outlook macro to check a value of a cell in an attachment and send an email based on that value ketangarg86 Outlook 13 03-25-2015 07:11 AM
Rename attachment based on attachment name Attachment issues rudi.scott Outlook 1 06-30-2011 06:44 AM
Rename attachment based on attachment name email as pdf attachment - subject line and attachment named after mail merge Nexus Mail Merge 12 04-13-2011 11:34 PM
Word attachment on an E-mail-macro to open attachment & nablady Outlook 0 11-28-2006 03:00 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:42 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2023 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft