+ Reply to Thread
Results 1 to 10 of 10

Using .replyrecipients in vba script (See attached)

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-16-2006
    MS-Off Ver
    OFFICE 365
    Posts
    244

    Using .replyrecipients in vba script (See attached)

    The attached file contains a script that works great for my purposes. However, instead of cc’ing the client and buyer I want use .replyrecipients. Unfortunately, I cannot use this with the ccStr string because it contains more than one email address and the .replyrecipients does not recognize multiple addresses. I could use .replyrecipients.add Buyer and .replyrecipients.add Client but this would only add the latest assigned value to the string. Any help is appreciated.


    · Kudos to Leith Ross for help with the initial coding.



    Thanks,
    Met
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Using .replyrecipients in vba script (See attached)

    Hi,

    There's no reason I know why a string variable of email addresses separated by ; can't be built and then used in the .To or .cc section of the email code.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    02-16-2006
    MS-Off Ver
    OFFICE 365
    Posts
    244

    Re: Using .replyrecipients in vba script (See attached)

    Richard:

    You are correct. The string works fine in the .To and .CC section of the email code. However, I want to use it in the .replyrecipients.add section and it does not seem to recognize multiple email addresses.

    Thanks,
    Met

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Using .replyrecipients in vba script (See attached)

    Hi,

    It seems Microsoft don't permit this, see https://msdn.microsoft.com/en-us/lib...ffice.11).aspx

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Using .replyrecipients in vba script (See attached)

    Thanks for the rep.

  6. #6
    Forum Contributor
    Join Date
    02-16-2006
    MS-Off Ver
    OFFICE 365
    Posts
    244

    Re: Using .replyrecipients in vba script (See attached)

    Thanks for the response. Actually, it works fine using a single email address. I can use .replyrecipients.add Buyer and .replyrecipients.add Client, in my attached example, but this would only add the latest assigned value to the string. Anyone know how I could add all of the email addresses and not just the last two?

    Thanks
    Met

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Using .replyrecipients in vba script (See attached)

    Hi,

    Maybe something like

    Formula: copy to clipboard
    Vendor = Vendor & ";" & Trim(Cell)


    in the For Each Cell loop

  8. #8
    Forum Contributor
    Join Date
    02-16-2006
    MS-Off Ver
    OFFICE 365
    Posts
    244

    Re: Using .replyrecipients in vba script (See attached)

    I have tried the variables inside the loop but inevitably it fails to capture all the assigned variables. I usually end up capturing the last variable. Thanks for your suggestion. Still looking for a way to add all to the reply line.

    Met

  9. #9
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Using .replyrecipients in vba script (See attached)

    Quote Originally Posted by Metrazal View Post
    I usually end up capturing the last variable. Thanks for your suggestion. Still looking for a way to add all to the reply line.

    Met
    Hi,

    That suggests that you're not concatenating the variables as you progress through your loop. i.e. use code like

    MyeMailString = MyeMailString & ";" & MyeCurrenteMailVariableString

  10. #10
    Forum Contributor
    Join Date
    02-16-2006
    MS-Off Ver
    OFFICE 365
    Posts
    244

    Re: Using .replyrecipients in vba script (See attached)

    Ok, in case someone has the same issue following is what I did to correct my issue. The main problem I was having was my inability to set the replyrecipients to more than one email string. The solution: use the verbiage .ReplyRecipientNames (this will allow you to use multiple email addresses.) Its that simple. Anyway, thanks for your suggestions and help.

+ 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. script to run the macro from Vb script with out opening the excel file
    By chandanp in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-27-2021, 03:33 AM
  2. calling the vb script from the shell script(unix platform)
    By chandanp in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-21-2014, 06:21 AM
  3. Replies: 0
    Last Post: 05-16-2012, 04:16 PM
  4. Integrating Mainframe emulator script with excel's vba script
    By Himanshu Mishra in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-07-2012, 10:30 AM
  5. Create VBA script to short, dedicated button in excel for script?
    By realized in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-01-2009, 11:54 PM
  6. Script that edits the text printed on the button that runs the script
    By petalred in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2008, 02:41 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