+ Reply to Thread
Results 1 to 14 of 14

VB Projects and XLM Sheets cannot be saved in a macro-free workbook.

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

    VB Projects and XLM Sheets cannot be saved in a macro-free workbook.

    Hello XL Guru,
    I got no idea why my new work book not working. While the old workbook i used the same code is doing fine but not this.

    Please Login or Register  to view this content.
    When i test run on the macro, it kept showing message as titled mentioned above.
    Greatly appreciated, if any1 would point out where my mistake is.

    I understand that macro could not run on a protected sheets. After google for hours, i found this userinterface thingy, still no luck.
    Attached Files Attached Files

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: VB Projects and XLM Sheets cannot be saved in a macro-free workbook.

    if the workbook being saved contains code you need file format xlOpenXMLWorkbookMacroEnabled
    Cheers
    Andy
    www.andypope.info

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

    Re: VB Projects and XLM Sheets cannot be saved in a macro-free workbook.

    Thanks for your reply, Andy.

    Tried that too, when i google around last 2 hours ago.
    Window, pop out the message as " This extension can not be used with the selected file type. Change the file extension in the file name text......."

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: VB Projects and XLM Sheets cannot be saved in a macro-free workbook.

    the extension you are using is "xlsx" which needs to be "xlsm"

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

    Re: VB Projects and XLM Sheets cannot be saved in a macro-free workbook.

    Same there. I am okay with it, if my new saved file is macro-enable or not.

    Before i come to board, i switch from .xslm and xslx. But both no luck.

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

    Re: VB Projects and XLM Sheets cannot be saved in a macro-free workbook.

    I even un-protect all of my 14 sheets and test it to run again. But still the same.

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: VB Projects and XLM Sheets cannot be saved in a macro-free workbook.

    This worked for me. Note I changed save path.

    Please Login or Register  to view this content.
    Also you Workbook_Open code should be in the Thisworkbook object if you want it to execute on openning.

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

    Re: VB Projects and XLM Sheets cannot be saved in a macro-free workbook.

    You mean this below?
    Please Login or Register  to view this content.
    Sorry to tell you. All of the code is i get help at excelforum and google.
    I understand partially from your replied above. But not really get it what object to change or something. Very sorry on this, i am a nut in VBA.

  9. #9
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: VB Projects and XLM Sheets cannot be saved in a macro-free workbook.

    currently that code is in a standard code module. It needs to be in the Thisworkbook code module.

    in VBE (ALT+F11)
    in project view (F4)
    you should see Thisworkbook listed within Microsoft Excel Object for that VB Project

    Cut and paste the code in there. Then next time the workbook is opened the Open event will fire and the code will be run

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

    Re: VB Projects and XLM Sheets cannot be saved in a macro-free workbook.

    Excelobject.png

    You mean "Thisworkbook" suppose to be listed on the left circled area?

  11. #11
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: VB Projects and XLM Sheets cannot be saved in a macro-free workbook.

    like this

    922380.png

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

    Re: VB Projects and XLM Sheets cannot be saved in a macro-free workbook.

    Ok, got it now. Partially okay on my code for now. Just that my saved file name does not work as coded.

    Hold a sec., need to get rid of that.

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

    Re: VB Projects and XLM Sheets cannot be saved in a macro-free workbook.

    Hi Andy, all set and good to go.
    Just that, i understand if i have another query, i should post a new thread again. If it is convenience for you, hope that you are able to advise me a little.

    Sheet(1) cell H1 is my reference number and newly saved file name.
    Is it possible to make exception on the below code, not to clear the contents on H1, so that another code of mine to +1 on the value is workable.

    Code - Clear Contents
    Please Login or Register  to view this content.
    Code +1 on H1
    Please Login or Register  to view this content.

  14. #14
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: VB Projects and XLM Sheets cannot be saved in a macro-free workbook.

    Why not store the content in a variable, just before clearing the sheet, and write it back out after clearing the sheet.

+ 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