+ Reply to Thread
Results 1 to 9 of 9

Macro to email Several Sheets

  1. #1
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,715

    Macro to email Several Sheets

    I have written a macro to email sheets "Sales1 to sheet "Sales3"


    The sheets must be saved as the as the name of the subject in B1 on sheet "Email"


    I get a run time error & the following code is highlighted


    I have attached sample data to make it easier for someone to see what I am trying to achieve


    Please Login or Register  to view this content.

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    11-26-2012
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    419

    Re: Macro to email Several Sheets

    Please Login or Register  to view this content.
    Results in this: 1/03/202009-Apr-20 13-05-07 which has slashes making it an invalid file name

    Maybe this will work:
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,715

    Re: Macro to email Several Sheets

    Thanks for the help. It sorted the run time error out

    I made a few changes to me macro and need the following to be amending in my macro


    1) When attaching to outlook , the email addresess are not displayed in To: (these are in F1:F3 on sheet "Email")
    2) The attached file must state the name in B1 on sheet :"Email" + the current date
    3) In the Body the names in E1 & E2 on sheet "Email" must appear after Hi



    Your assistance is most appreciated


    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor
    Join Date
    11-26-2012
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    419

    Re: Macro to email Several Sheets

    You don't specify which worksheet the range is on, so it is using the active one, and the values in F1:F4 are blank.
    Please Login or Register  to view this content.
    Try this:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,715

    Re: Macro to email Several Sheets

    Thanks for the help, macro working perfectly now

  6. #6
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,715

    Re: Macro to email Several Sheets

    When running the macro on live data , I found that where there were formula's and it had range names, I would get #name error

    I want the data to appear as values only so it must be copied to the sheets to be attached as values only

    I think that this part of the formula needs to be amended but not sure how to amend


    It would be appreciated if you could kindly amend this

    Please Login or Register  to view this content.
    Kindly make the necessary change so that the sheets created to be attached are values only I.E no formulas

    Full code below

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,715

    Re: Macro to email Several Sheets

    Hi mgs73


    It would be appreciated if you can have a look at my post # 6 and amend the code to suit my requirement

  8. #8
    Valued Forum Contributor
    Join Date
    11-26-2012
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    419

    Re: Macro to email Several Sheets

    I don't see anything wrong with your code, and could not reproduce your error on my own workbook. Can you upload a workbook that demonstrates this issue?

  9. #9
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,715

    Re: Macro to email Several Sheets

    My apologies. Tested again & code does work

+ 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. Macro to email sheets
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-12-2018, 11:03 AM
  2. Macro to email sheets to many users
    By jchillal in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2017, 11:21 AM
  3. [SOLVED] Email sheets macro errors if no sheets match
    By BPSJACK in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-18-2016, 01:21 PM
  4. Macro to email individual sheets to employees
    By NeoDasari in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-23-2015, 09:24 AM
  5. Macro to search email address in all sheets
    By kishoremcp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-22-2014, 04:57 AM
  6. macro email two sheets in one file to user
    By matrix_xrs in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-13-2013, 01:45 PM
  7. Macro to Email Multiple Sheets
    By regularmark in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-06-2011, 04:20 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