+ Reply to Thread
Results 1 to 17 of 17

VBA Code to Save Copy File without Macro Button and VBA Code on Copy?

  1. #1
    Forum Contributor
    Join Date
    08-28-2012
    Location
    Klang, Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    113

    VBA Code to Save Copy File without Macro Button and VBA Code on Copy?

    Hi All,
    Just wanted to know is it possible to run VBA save new copy of file without macro button and VBA Code?
    My master copy is .xlsm format. After clicking the macro button on my master copy, it will become .xlsx file.

    Can we or does VBA able to run a code without macro button and VBA Code on the new saved copy? Except the formula on all the cells remain unchanged.
    Hope to get advise and guide from you guy

    My current code as below, result from google and modify a little.

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: VBA Code to Save Copy File without Macro Button and VBA Code on Copy?

    You don't need a button for that u can try using beforeclose macro.
    Please Login or Register  to view this content.
    Only one thing is if you save a copy as .xlsx then when you open the copy the macros won't work or I think you will get an error that will say that your sheet contains macros and so on...

  3. #3
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: VBA Code to Save Copy File without Macro Button and VBA Code on Copy?

    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  4. #4
    Forum Contributor
    Join Date
    08-28-2012
    Location
    Klang, Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    113

    Re: VBA Code to Save Copy File without Macro Button and VBA Code on Copy?

    Look like will be more troublesome on that way, no any other way? or just clear out the VBA code on new save file copy?

  5. #5
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: VBA Code to Save Copy File without Macro Button and VBA Code on Copy?

    You wan't the copy saved with no macros inside the copy? just an ordinary workbook .xlsx?

  6. #6
    Forum Contributor
    Join Date
    08-28-2012
    Location
    Klang, Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    113

    Re: VBA Code to Save Copy File without Macro Button and VBA Code on Copy?

    Quote Originally Posted by stojko89 View Post
    You wan't the copy saved with no macros inside the copy? just an ordinary workbook .xlsx?
    Yeah, want the newly auto saved copy to be normal .xlsx excel file with no vba code or/and macro.

  7. #7
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: VBA Code to Save Copy File without Macro Button and VBA Code on Copy?

    when you save as xlsx the code will be not saved, you don'd need delete id, you need only delete button with
    ActiveSheet.Shapes.Range(Array("Button 1")).Delete
    with correct button name

  8. #8
    Forum Contributor
    Join Date
    08-28-2012
    Location
    Klang, Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    113

    Re: VBA Code to Save Copy File without Macro Button and VBA Code on Copy?

    I will need to change the "button1" to the exact name where i placed in the button box only? Rest of the code, remain unchanged?

    ActiveSheet.Shapes.Range(Array("Button 1"))

  9. #9
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: VBA Code to Save Copy File without Macro Button and VBA Code on Copy?

    And don't forget about .Delete at the end

  10. #10
    Forum Contributor
    Join Date
    08-28-2012
    Location
    Klang, Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    113

    Re: VBA Code to Save Copy File without Macro Button and VBA Code on Copy?

    I dont know what is my button name. How to know or see?

  11. #11
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: VBA Code to Save Copy File without Macro Button and VBA Code on Copy?

    Click on the button and above Cell A1 the name will show in a small window or right click it

  12. #12
    Forum Contributor
    Join Date
    08-28-2012
    Location
    Klang, Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    113

    Re: VBA Code to Save Copy File without Macro Button and VBA Code on Copy?

    I placed it exactly the same as below,
    Please Login or Register  to view this content.
    Showing run time error 438

  13. #13
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: VBA Code to Save Copy File without Macro Button and VBA Code on Copy?

    Your button is named o9 ?
    I told you not to forget .Delete

  14. #14
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: VBA Code to Save Copy File without Macro Button and VBA Code on Copy?

    try this:
    Please Login or Register  to view this content.

  15. #15
    Forum Contributor
    Join Date
    08-28-2012
    Location
    Klang, Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    113

    Re: VBA Code to Save Copy File without Macro Button and VBA Code on Copy?

    Error too, 1004.
    Attached Files Attached Files

  16. #16
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: VBA Code to Save Copy File without Macro Button and VBA Code on Copy?

    This works fine in your file for me:
    Please Login or Register  to view this content.
    Just change the NewFN back to your original path.

  17. #17
    Forum Contributor
    Join Date
    08-28-2012
    Location
    Klang, Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    113

    Re: VBA Code to Save Copy File without Macro Button and VBA Code on Copy?

    Got it now. thanks a lot man!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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