+ Reply to Thread
Results 1 to 6 of 6

Replace entire subject line

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,946

    Replace entire subject line

    I have a macro I made a few years ago, which replaces a value in the subject lines of all emails you've selected. The code is below. I ran into a snag this morning, and am at a loss as to how to work around it. My macro was already working if I want to replace a value with nothing; in that case, for "nothing" I just leave the field blank. But today I ran into a situation where I wanted to replace the full subject line with a different value. Putting an Asterisk in the Text to Replace causes the macro to replace nothing, and putting nothing in the Text to Replace also causes no replacement. How would I tell me macro to replace ALL of the subject line?
    Please Login or Register  to view this content.
    I know I'm not stupid, but I suspect I'm a lot stupider than I think I am

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Replace entire subject line

    As far as I know VBA Replace doesn't work with wildcards, so if you've put '*' as the value you want to replace then replace is going to try and find the literal string '*'.
    If posting code please use code tags, see here.

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,946

    Re: Replace entire subject line

    I agree, but knowing that still doesn't help with "How would I tell me macro to replace ALL of the subject line? "

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Replace entire subject line

    Check if RepWhat is '*' and if it is replace the entire subject line with RepWith.
    Please Login or Register  to view this content.
    Last edited by Norie; 10-16-2019 at 01:45 PM.

  5. #5
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,946

    Re: Replace entire subject line

    Good solution! I can work with that one. Thanks!

  6. #6
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,946

    Re: Replace entire subject line

    Whoops, almost forgot to post my updated macro. I try to make it habit to post the final solution (or at least MY final solution) in case someone else needs it.
    Please Login or Register  to view this content.

+ 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] Help comparing two files by subject+Date, subject+DatePlus1, Subject+DateMinus1
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 07-11-2017, 07:37 AM
  2. [SOLVED] Subject line: Pivot chart’s one line is correct but the other line not correct?
    By Mirisage in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 10-21-2014, 11:20 AM
  3. How to highlight the ENTIRE row subject to a specific cell?
    By sami770 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-06-2012, 03:37 AM
  4. Replies: 1
    Last Post: 05-11-2011, 07:11 AM
  5. Customize Subject Line
    By terezakat in forum Excel General
    Replies: 0
    Last Post: 07-25-2005, 05:47 PM
  6. Using a cell value as the subject line
    By Qaspec in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-08-2005, 11:05 AM
  7. [SOLVED] Populate the subject line.
    By Scott Hutchinson in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-18-2005, 05:06 PM

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