+ Reply to Thread
Results 1 to 10 of 10

Change each subject line in selection

  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,952

    Change each subject line in selection

    I'm trying to make a macro to remove certain elements from the subject lines of my selected emails, and I've hit a snag. My code so far is below, cobbled together from everything I could find. It works, kind of. The whole idea is to change all of the items I've selected, but no matter what I do it only changes the first one. I'm sure I'm missing something, but can't figure it out. Any help would be appreciated.

    AFTER I get the "do all" part fixed, next step would be to have input boxes so users could input the change and replacement text. Haven't had a chance yet to work on that part.

    Thanks,
    John
    Please Login or Register  to view this content.

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

    Re: Change each subject line in selection

    I got it! It finally percolated through my confused mind! Code so far (I'll try to remember to post after I completely finish it, but that might be a few days as I'm being called to other duties.)
    Please Login or Register  to view this content.

  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,952

    Re: Change each subject line in selection

    Okay, I need help with the next step. See the line of code below:
    Please Login or Register  to view this content.
    "[New Post] " could also be "[SPAM] ", "[SUSPECTED SPAM] ", "[MARKETING] ", etc. So what I'd like to do is replace[*] with nothing, but I can't figure out how to do wildcard in the above code. I thought this would work:
    Please Login or Register  to view this content.
    , but the VBA editor puts it in red, so something's wrong. Any help would be appreciated.

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

    Re: Change each subject line in selection

    "Replace" might be feasible but here is some less elegant code.

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

  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,952

    Re: Change each subject line in selection

    Skatonni,

    Great code; the only issue I had was that after the "]" there is a space, and the code wasn't removing that space. I solved it by changing this line:
    Please Login or Register  to view this content.
    Please let me know if there's a better way to resolve the issue, and thank you so much for your help!

  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,952

    Re: Change each subject line in selection

    Found another issue; email subject line like this:
    Please Login or Register  to view this content.
    The "[SPAM][MARKETING] " at the front isn't the issue, it's the "[Video]" at the back. How do we resolve that? It's not a deal-breaker, but I'd like to have a solution.

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

    Re: Change each subject line in selection

    I think you will have better luck with "Trim" rather than "endPos - 1".
    Please Login or Register  to view this content.

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

    Re: Change each subject line in selection

    Thanks Skatonni;
    Taking your advice, I've altered my original macro, and now have two different macros, one to Replace anything in the subject line, and one to delete anything Bounded by [ and ]. Still now sure how to handle
    Please Login or Register  to view this content.
    Absent of a fix for that, here are my two existing macros:
    Please Login or Register  to view this content.

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

    Re: Change each subject line in selection

    It would be better if you described the problem with [VALUE] rather having people guess. I see no problem.

    Please Login or Register  to view this content.

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

    Re: Change each subject line in selection

    Sorry I didn't see your post, so this reply is late. You're right, there is no issue now. I didn't realize the last fix had resolved the issue. Thanks so much for all your help on this.

+ 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] 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
  2. [SOLVED] Custom subject line with vb
    By Wheelie686 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-21-2013, 01:54 PM
  3. [SOLVED] How to change the message subject line in VBA
    By muheebrahman in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 07-31-2013, 03:05 AM
  4. Change subject line of external software using outlook.
    By asafm1 in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 07-11-2013, 07:27 AM
  5. How to change "From" & to have a dynamic "Subject" line in Excel Mailing
    By andy_iyeng in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-25-2012, 03:04 AM
  6. Want to change attached file name & subject line in the coding : Email Range
    By Kapil007 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-30-2010, 07:45 AM
  7. 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

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