+ Reply to Thread
Results 1 to 2 of 2

Save outlook attachment as file using email subject as file name w/o invalid characters

  1. #1
    Registered User
    Join Date
    10-12-2015
    Location
    PLANO, TX
    MS-Off Ver
    2007
    Posts
    1

    Save outlook attachment as file using email subject as file name w/o invalid characters

    I have the very basic code that will grab (using rules) specific inbound emails and save down the attachment to a local drive.
    I would like to be able to identify the attachments by a number that is unfortunately included in the email subject instead of the attachment display name.
    The subject is also riddled with invalid characters (example: OTTC WO Advice Report - Customer: Murex LLC Reference: 1895478 Transport Unit: TTE 2546 / TTE 1975 / D. OWENS Order #: 183006-1.1 and in this example, all I need is the 1895478 to ID it correctly)

    Any advice on how to pull out the invalid characters would be awesome!!

    Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
    Dim objAtt As Outlook.Attachment
    Dim saveFolder As String
    saveFolder = "O:\1 - Terminals And Transloads\1 - Oiltanking Texas City\EDI Truck BoLs\"
    For Each objAtt In itm.Attachments
    objAtt.SaveAsFile saveFolder & "\" & itm.Subject & " " & objAtt.DisplayName
    Set objAtt = Nothing
    Next
    End Sub

  2. #2
    Forum Contributor
    Join Date
    08-27-2006
    Posts
    136

    Re: Save outlook attachment as file using email subject as file name w/o invalid character

    This demonstrates some methods. Open an item then run LegalName. Add problem characters to the code if necessary.

    Please Login or Register  to view this content.
    To mark "Solved" go to Thread Tools.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Modify VBA to save attachment with Subject line as file name??
    By dwhite30518 in forum Outlook Formatting & Functions
    Replies: 2
    Last Post: 02-27-2017, 11:32 AM
  2. Replies: 2
    Last Post: 09-11-2015, 04:24 AM
  3. [SOLVED] Save Outlook Attachements based on Date & file/Subject name
    By Naveed Raza in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-18-2015, 11:35 PM
  4. Replies: 0
    Last Post: 01-20-2015, 10:07 PM
  5. Replies: 0
    Last Post: 08-14-2013, 04:26 PM
  6. [SOLVED] Macro to Rename Outlook Attachment Same as Email Subject
    By sandy_314 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-24-2013, 09:59 AM
  7. Outlook, print pdf Save Attachment, Move Email To A Subfolder
    By stephen1000 in forum Outlook Programming / VBA / Macros
    Replies: 7
    Last Post: 11-16-2009, 07:18 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1