+ Reply to Thread
Results 1 to 4 of 4

Macro - SaveCopyAs and Remove VBA Code

  1. #1
    Registered User
    Join Date
    10-20-2011
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    3

    Macro - SaveCopyAs and Remove VBA Code

    Hello,

    I need to develop a macro that automatically and silently saves a copy of an Excel Document to a location while stripping the VBA code that copies it. All of this needs to be automated with no user interaction.

    This is what I have so far.

    ThisWorkbook


    Please Login or Register  to view this content.
    Module 1

    Please Login or Register  to view this content.
    This code works great for my needs except the copy opens and attempts to run the macro on the "Loop schedule" and displays a debug error message. I need the copy stripped of the macro so the sheet wont display the error code.

    Any help is greatly appreciated.

    Thanks

    -Matt

  2. #2
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: Macro - SaveCopyAs and Remove VBA Code

    Don't know where the Loop Schedule macro is, but consider saving it as an xlsx format file? That will remove any macro in the workbook.

  3. #3
    Registered User
    Join Date
    10-20-2011
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Macro - SaveCopyAs and Remove VBA Code

    I did try just saving as a .xlsx but everytime I do that I get a "File is corrupt" error when opening the copy.

    I noticed that I entered my code wrong. The "This Workbook" code is correct but the Module 1 code should be as below.

    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: Macro - SaveCopyAs and Remove VBA Code

    Try saving it using

    Please Login or Register  to view this content.
    This should save it into a valid xlsx excel file.

    Note: and change the save name to
    Please Login or Register  to view this content.

+ 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