+ Reply to Thread
Results 1 to 1 of 1

Outlook attachment Rename

Hybrid View

  1. #1
    Registered User
    Join Date
    05-22-2011
    Location
    chennai
    MS-Off Ver
    Excel 2003
    Posts
    71

    Outlook attachment Rename

    Hi

    Using VBA I'm trying to rename the attachment in the email that we received in outlook - Could you please help me guys.

    Thanks
    Thiru

    This what I have tried so far!!!

    Public Sub FolderPick()
    
        Dim objNS As NameSpace
        Dim objFolder As MAPIFolder
        Dim aItem As Object
        Dim emailcount As Integer
        Dim emailcounter As Integer
        Dim attach As Outlook.attachment
    
        
        Set objNS = Application.GetNamespace("MAPI")
        Set objFolder = objNS.PickFolder
    
        If TypeName(objFolder) <> "Nothing" Then
            Debug.Print vbCr & " objFolder: " & objFolder
        Else
            Debug.Print vbCr & "Cancel"
            GoTo 20
        End If
    
        emailcount = objFolder.Items.Count
        i = 1
                
        For Each aItem In objFolder.Items
        emailcounter = emailcount - i + 1
        'MsgBox aItem.Subject
          aItem.Subject = aItem.Subject & " " & emailcounter
          For Each attach In aItem.Attachments
          MsgBox attach.DisplayName
          attach.DisplayName = "Hi"
    Next
        i = i + 1
        Next
        
        Set objFolder = Nothing
        Set objNS = Nothing
        
    MsgBox "Completed"
    
    Exit Sub
    
    20
    MsgBox "You haven't selected any folder"
    End Sub
    Last edited by JBeaucaire; 06-16-2015 at 08:54 AM. Reason: Resetting thread to zero replies to encourage additional answers.

+ 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. [SOLVED] Download attachment and rename with subject line
    By ali84pk in forum Outlook Programming / VBA / Macros
    Replies: 11
    Last Post: 07-25-2023, 12:01 PM
  2. Download Attachment and Rename With Subject Line v2
    By CBJason in forum Outlook Programming / VBA / Macros
    Replies: 2
    Last Post: 07-26-2014, 04:33 PM
  3. Save and Rename Attachment based on Sender
    By PicoTTS in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 03-14-2014, 10:06 PM
  4. [SOLVED] VBA Macro to print to Pdf format and place as attachment in Outlook (Excel & Outlook 2007)
    By Webman1012 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-29-2013, 01:25 PM
  5. [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

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