+ Reply to Thread
Results 1 to 7 of 7

Excel Template Files

  1. #1
    Forum Contributor
    Join Date
    11-17-2004
    MS-Off Ver
    Office 2016
    Posts
    527

    Excel Template Files

    When you create a new document based on a Macro-Enabled Template (*.xltm), shouldn't the file it creates have the default file type of a Macro-Enabled Workbook (*.xlsm) instead of a standard Excel Workbook (*.xlsx)? So many of the users don't respond properly to the prompt when saving that when they open the file later, they've lost all the functionality.

    I've tried using VBA to set the file type in various ways thanks to the helpful suggestions from this group, and as long as the user doesn't cancel out of the dialog or mess things up, it works fine but selecting Cancel, for instance, during the save-as causes the worksheet to save itself anyway with "FALSE.xlsm" as the file name....it does get the correct file type, but I cannot have all my files trying to save to that name.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Excel Template Files

    Quote Originally Posted by JimDandy View Post
    I've tried using VBA to set the file type in various ways thanks to the helpful suggestions from this group, and as long as the user doesn't cancel out of the dialog or mess things up, it works fine but selecting Cancel, for instance, during the save-as causes the worksheet to save itself anyway with "FALSE.xlsm" as the file name....it does get the correct file type, but I cannot have all my files trying to save to that name.
    Can you show your code?
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    11-17-2004
    MS-Off Ver
    Office 2016
    Posts
    527

    Re: Excel Template Files

    This is code I received from another forum member, it's in ThisWorkbook object under BeforeSave:

    Please Login or Register  to view this content.
    It performs "okay" as long as you don't change your mind midway through saving.

    I've tried various methods to change the file type during save, and none of them are without some sort of failure if you step outside the norm. My concern is that as a Macro-Enabled Template, the result file should default to Macro-Enabled Workbook out of the box too without having to resort to using VBA code to accomplish this. It may be that I'm missing a setting somewhere...

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Excel Template Files

    Just move the one line to where it is below. If they cancel, the file is not saved.

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    11-17-2004
    MS-Off Ver
    Office 2016
    Posts
    527

    Re: Excel Template Files

    Ok, that was great...thank you!

  6. #6
    Registered User
    Join Date
    08-14-2013
    Location
    Arizona
    MS-Off Ver
    Excel 2007
    Posts
    71

    Re: Excel Template Files

    Moved to new thread
    Last edited by jwlamb; 10-04-2013 at 11:06 AM.

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Excel Template Files

    It doesn't have anything to do with the message box. You would test if the File Name returned from .GetSaveAsFilename prompt equals False to determine if they canceled that prompt.

    This site has some good code examples
    Use VBA SaveAs

    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)

Similar Threads

  1. [SOLVED] Exporting data from master file to pre-populate many excel files from a template
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 08-07-2013, 07:52 AM
  2. How to change a template that is in many files
    By Onesock in forum Excel General
    Replies: 4
    Last Post: 10-27-2012, 03:26 PM
  3. Excel files opening as a template
    By gjjh25 in forum Excel General
    Replies: 5
    Last Post: 10-21-2011, 02:23 PM
  4. Updating Excel Files...Old Template to New Template???
    By theRDstore in forum Excel General
    Replies: 9
    Last Post: 01-06-2009, 06:48 PM
  5. Template files don't work
    By Ken in forum Excel General
    Replies: 1
    Last Post: 10-29-2005, 07:05 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