Closed Thread
Results 1 to 7 of 7

Outlook, rename subject of selected emails, VBA

  1. #1
    Registered User
    Join Date
    01-11-2013
    Location
    London
    MS-Off Ver
    Excel 2013, 2016
    Posts
    95

    Outlook, rename subject of selected emails, VBA

    Hi gurus,

    Trying to rename several selected emails in Outlook via the following script which only works for 1 selected mail.

    Would anyone be so kind to point me to the right direction to be able to rename subject to all selected emails, please.

    Please Login or Register  to view this content.
    Greetings,

    Dude6571
    Last edited by dude6571; 10-29-2018 at 09:06 AM. Reason: Moved from Outlook Formatting & Functions

  2. #2
    Registered User
    Join Date
    01-11-2013
    Location
    London
    MS-Off Ver
    Excel 2013, 2016
    Posts
    95

    Re: Outlook, rename subject of selected emails, VBA

    Please find working code below. You can split into 2 macros if you want.

    Please Login or Register  to view this content.
    Last edited by dude6571; 11-09-2018 at 07:54 AM.

  3. #3
    Registered User
    Join Date
    01-11-2013
    Location
    London
    MS-Off Ver
    Excel 2013, 2016
    Posts
    95

    Re: Outlook, rename subject of selected emails, VBA

    Add Word in Subject line

    Please Login or Register  to view this content.
    Last edited by dude6571; 11-09-2018 at 08:53 AM.

  4. #4
    Registered User
    Join Date
    01-11-2013
    Location
    London
    MS-Off Ver
    Excel 2013, 2016
    Posts
    95

    Re: Outlook, rename subject of selected emails, VBA

    Remove Word in Subject line

    Please Login or Register  to view this content.

  5. #5
    Spammer
    Join Date
    05-11-2023
    Location
    India
    MS-Off Ver
    Ms office 7
    Posts
    8

    Re: Outlook, rename subject of selected emails, VBA

    You can use VBA code to rename the subject of selected emails in Outlook. Here's an example of how to do it:

    Open Outlook and press Alt + F11 to open the VBA editor.

    In the VBA editor, right-click on your Outlook VBAProject and choose Insert > Module.

    Copy and paste the following code into the module:

    Sub RenameSelectedEmails()
    Dim objItem As Object
    Dim objMail As MailItem
    Dim strNewSubject As String

    For Each objItem In Application.ActiveExplorer.Selection
    If TypeOf objItem Is MailItem Then
    Set objMail = objItem
    strNewSubject = InputBox("Enter a new subject for the email", "Rename Email Subject", objMail.Subject)
    objMail.Subject = strNewSubject
    objMail.Save
    End If
    Next objItem

    Set objItem = Nothing
    Set objMail = Nothing
    End Sub

    Save the module and return to Outlook.

    Select one or more emails that you want to rename the subject of.

    Click the Developer tab in the ribbon (if you don't see the Developer tab, go to File > Options > Customize Ribbon and check the Developer box).

    Click the Macros button in the ribbon.

    Select the RenameSelectedEmails macro and click Run.

    Enter the new subject for the email(s) in the InputBox and click OK.

    The macro will loop through each selected email and prompt you to enter a new subject. Once you enter the new subject and click OK, the macro will update the subject and save the email.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2403 Win 11 Home 64 Bit
    Posts
    23,811

    Re: Outlook, rename subject of selected emails, VBA

    @Hitulseo
    this is a thread from five years ago. Please address your responses to current issues. Also, you have avoided using code tags. Please read our forum rules you agreed to and abide by them.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,532

    Re: Outlook, rename subject of selected emails, VBA

    The response is also an AI result.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 09-07-2015, 04:05 PM
  2. Save outlook attachments and rename/append files with identifier from subject line
    By XLnExcel in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-18-2015, 12:49 PM
  3. [SOLVED] excel userform to show emails on selected subject from listbox
    By Megatronixs in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-16-2015, 02:46 PM
  4. Replies: 0
    Last Post: 11-14-2014, 08:56 AM
  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
  6. Outlook - prevent sending of emails without a subject matter
    By ErnieLaboy in forum Outlook Formatting & Functions
    Replies: 1
    Last Post: 01-04-2013, 12:40 PM
  7. [SOLVED] Search and Flag the Emails in Outlook based on the Data in Excel (Subject column)
    By anchuri_chaitanya in forum Outlook Programming / VBA / Macros
    Replies: 9
    Last Post: 03-17-2012, 12:35 AM

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