+ Reply to Thread
Results 1 to 4 of 4

XLSM VBA code autosave problem

  1. #1
    Registered User
    Join Date
    03-20-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    62

    XLSM VBA code autosave problem

    Hi, can anyone help me with this: -

    I have assigned the following macro to a command button: -

    Sub savebook()
    Dim FPATH As String
    FPATH = "T:\DEVELOPMENT\P134 MODULAR SIGNALLING\DEVELOPMENT\SPREADSHEETS\Production Scans\ILS Production Batch\Multi Aspect\"
    ActiveWorkbook.SaveAs FPATH & Range("G2").value & ".XLSM"
    End Sub

    When I press the command button I get the following message: -

    Run-time error '1004':

    This extension cannot be used with the selected file type. Change the file extension in the file name text box or select a different file type by changing the save as type.

    The code works if I change to a .XLS file but I need all the macros to be able to run in the workbook.

    I'm using excel 2007.

    Thanks in advance.

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: XLSM VBA code autosave problem

    Please Login or Register  to view this content.
    You have to set the fileformat to macro enabled.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Registered User
    Join Date
    03-20-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    62

    Re: XLSM VBA code autosave problem

    Thanks Solus, that worked brilliantly, much appreciated

  4. #4
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: XLSM VBA code autosave problem

    Glad to help. Welcome to the forum.

    Thanks for the rep! If you are happy with the solution please mark the thread as [SOLVED] using the thread tools at the top.

+ 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] Copy/Save As xlsm workbook to new xlsm workbook is not copying the code with it
    By Grinchy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-02-2013, 09:30 AM
  2. Replies: 3
    Last Post: 05-21-2013, 08:22 AM
  3. Problem with Autosave
    By Brian Clarke in forum Excel General
    Replies: 2
    Last Post: 05-12-2006, 08:50 AM
  4. Disable Autosave via Code
    By John Daily in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-20-2006, 02:25 PM
  5. Opened Autosave but when closing workbook Autosave closes itself
    By Ken in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-29-2005, 01:05 PM

Tags for this Thread

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