+ Reply to Thread
Results 1 to 5 of 5

Copying sheets and macros to new workbook

  1. #1
    Registered User
    Join Date
    05-02-2013
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    5

    Copying sheets and macros to new workbook

    Hoping someone can give me a hand with this growing macro. I have it doing just about everything I want it to do, except when it copies from the original .xlsm workbook and emails itself its changed from .xlsm to .xlsx, and tries using the original workbooks macros. I just want it to copy the data from the work request form and log it in work request form - history, then email all of it, including the macros. Thanks in advance!

    Please Login or Register  to view this content.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Copying sheets and macros to new workbook

    Hi, TheRealLethality,

    check the format of any new workbook in your system within the Options of Excel, it should be set to xlsx. Maybe change that in the Options or the code to reflect that you would need an xlsm.

    ...and tries using the original workbooks macros.
    Hard to test without the original workbook as we do not know how you attached the macros.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    05-02-2013
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Copying sheets and macros to new workbook

    Quote Originally Posted by HaHoBe View Post
    Maybe change that in the Options or the code to reflect that you would need an xlsm.
    Thanks for replying Holger
    I can get it to send it as a .xlsm by mangling the code a bit (see below) but I still can't figure out how to attach the macro modules with the new .xlsm that is emailed. I have attached my workbook as well if you want to check it out. You will have to add your email into the code for it to send itself. When you click submit it will use outlook to email it right back to you. You can then open the new workbook that is now an .xlsm but it is still missing the needed original workbooks macro modules.
    Please Login or Register  to view this content.
    Thanks again
    Regards
    Lethality
    Attached Files Attached Files

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Copying sheets and macros to new workbook

    Hi, TheRealLethality,

    the code behind the sheets should be copied without any problem due to the copying of sheets. If you have other code than that you should consider to use SaveCopyAs to create a full copy of the workbook and then strip off all the worksheets you donīt need, save again. To me this would be easier than handle the restrictions regarding usage of VB, trusted places etc. Maybe have a glance at Programming The VBA Editor for a start.

    Please Login or Register  to view this content.
    would be the only codeline you would need I suggesst if you want to save as macro-enabled and Extension xlsm.

    Ciao,
    Holger

  5. #5
    Registered User
    Join Date
    05-02-2013
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Copying sheets and macros to new workbook

    Thanks Holger
    I had that webpage opened on a tab in my browser, and was just getting ready to start reading on how to "Copy A Module From One Project To Another".

    Regards,
    Lethality

+ 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. Creating a new workbook, copying sheets & saving workbook - Subscript error
    By amphinomos in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-30-2014, 09:04 AM
  2. Copying sheets from a closed workbook - Excel 2013 crashes Sheets.Add
    By perducci in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-10-2014, 09:03 PM
  3. Copying macros with Worsheet into new workbook.
    By cholmes in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-19-2013, 11:08 AM
  4. Copying macros across Excel sheets
    By controlfreak in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-28-2012, 06:44 AM
  5. Copying macros from a file to Personal Workbook
    By excel nubie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-04-2007, 12:31 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