+ Reply to Thread
Results 1 to 8 of 8

Save copy of (filled in) template without VBA in the saved copy

  1. #1
    Registered User
    Join Date
    07-08-2013
    Location
    Irrelevant
    MS-Off Ver
    Excel 2010
    Posts
    15

    Save copy of (filled in) template without VBA in the saved copy

    Guys,

    As the topic title says..

    I have a template which I do not ever want to modify, however upon closing the template it should save a copy of the template but without VBA enabled. Without disabling VBA it works using this:

    Please Login or Register  to view this content.
    However when I make this of it, it fails:

    Please Login or Register  to view this content.
    Any clues why the first thing works but the second doesn't?

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Save copy of (filled in) template without VBA in the saved copy

    What is happening?

    I think it is your file format, should be 51.
    Last edited by nathansav; 08-29-2014 at 05:59 AM.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Registered User
    Join Date
    07-08-2013
    Location
    Irrelevant
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Save copy of (filled in) template without VBA in the saved copy

    Translated: Compile error - Can't find the mentioned argument

    It selects Fileformat:= and it highlights Private Sub Workbook_BeforeClose(Cancel As Boolean) in yellow.

  4. #4
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Save copy of (filled in) template without VBA in the saved copy

    Save copy as doesnt have the arguments, you need to save as the xlsx first, then resave as xlsm i think. Excels help file shows:

    expression.SaveAs(FileName, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AccessMode, ConflictResolution, AddToMru, TextCodepage, TextVisualLayout, Local)

    expression.SaveCopyAs(Filename)

  5. #5
    Registered User
    Join Date
    07-08-2013
    Location
    Irrelevant
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Save copy of (filled in) template without VBA in the saved copy

    Yeah but SaveAs somehow overwrites my template instead of making a copy with the filled in data and leaving the template alone..

  6. #6
    Registered User
    Join Date
    07-08-2013
    Location
    Irrelevant
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Save copy of (filled in) template without VBA in the saved copy

    OK I now did it like this:

    Please Login or Register  to view this content.
    It leaves the main (template) XLSM intact and saves n XLSX copy at the defined location using the proper name. However it now popups saying you will loose macros etc. before exiting the template. Can I somehow prevent that popup from showing?

  7. #7
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Save copy of (filled in) template without VBA in the saved copy

    Do some investigation on it. Its your work after all.

  8. #8
    Registered User
    Join Date
    07-08-2013
    Location
    Irrelevant
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Save copy of (filled in) template without VBA in the saved copy

    Please Login or Register  to view this content.
    Did it like this eventually. Hopefully doesn't mess up anything.

+ 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] looper to copy tabs of a data file into template and save as
    By amartin575 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 02-26-2014, 10:47 AM
  2. Save copy as, open copy, alter copy, save copy and close copy
    By tradinup2 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-03-2013, 04:42 PM
  3. Multi process macro - save open WB, copy data to new WB, del saved...
    By Alexm963 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-31-2012, 01:42 AM
  4. Replies: 0
    Last Post: 06-02-2006, 01:30 PM
  5. [SOLVED] Open a template, copy 3 worksheets w ranges and save as workbook
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-03-2006, 01:35 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