+ Reply to Thread
Results 1 to 5 of 5

email a vba code-containing sheet

  1. #1
    Forum Contributor
    Join Date
    05-10-2011
    Location
    Budapest, Hungary
    MS-Off Ver
    Excel 2016
    Posts
    187

    email a vba code-containing sheet

    Hi All,

    I have a workbook, that has a sheet that contains some code.
    I want to email this sheet, and I want the receipient to execute the macro, therefore I copy this sheet into a new workbook and email it.
    When the user opens th workbook, he cannot execute it, as the macro still refers the source-file, which is logic, but I didn't think about it.
    What is the way of sending a sheet only with some code? (I don't want to send the entire workbook.)
    Thanks

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: email a vba code-containing sheet

    The same way, but keep in mind that if your code is in the VBA project itself you will need to send that too, so simply said.
    Email the workbook with the code and remove the unnecessary sheets
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Contributor
    Join Date
    05-10-2011
    Location
    Budapest, Hungary
    MS-Off Ver
    Excel 2016
    Posts
    187

    Re: email a vba code-containing sheet

    Thanks for your answer.
    The information I was looking for - maybe my question was not accurate enough - how can I update the reference of the macro, when I copy it from its original place and put into a different workbook.
    And the answer (or one of the possible answers is) is that the shape, that runs the macro has an property that called OnAction, and it can be changed programatically.
    So, if you move your sheet that has a macro, the OnAction-parameters should also be updated accordingly.

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: email a vba code-containing sheet

    Can't help without the actual file since I don't know what you're doing when you send the email.
    I suggest you make sure it does not contain private data and upload a sample file with the situation you have and what you want.

  5. #5
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: email a vba code-containing sheet

    Hi Harry,

    can I update the reference of the macro, when I copy it from its original place and put into a different workbook.
    a. When you save a file in a manner such as 'save as' the 'OnAction' references all point to the 'save as' Workbook. If you delete things from the 'save as' Workbook everything will point to the proper place.

    b. When you copy sheets, the 'OnAction' references point to original File . You have to manually or programmatically change the 'OnAction' references to point to the correct workbook.

    Lewis

+ 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] Code to send email & loop through sheet
    By Jamesraywebber85 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-16-2018, 08:31 PM
  2. change email code to use with range instead of sheet
    By dotxls in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-07-2018, 02:26 AM
  3. change email code to use with range instead of sheet
    By dotxls in forum Excel General
    Replies: 3
    Last Post: 02-07-2018, 02:26 AM
  4. [SOLVED] VBA Code to email multiple people and code to go to the next email if error occurs
    By pmeltzers in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-17-2018, 12:31 PM
  5. Replies: 0
    Last Post: 07-05-2017, 09:36 PM
  6. [SOLVED] Vba code to copy unique email id data from input sheet to output sheet
    By UPA in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-09-2017, 07:19 AM
  7. Using code to email a sheet but need to strip the code before sending
    By dcgrove in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 02-05-2009, 01:44 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