+ Reply to Thread
Results 1 to 9 of 9

Excel 2007 : can I force xl2007 to save in .xls format

  1. #1
    Registered User
    Join Date
    12-04-2007
    Posts
    26

    Question can I force xl2007 to save in .xls format

    The macros I have embedded in my excel files are being stripped out when my coworkers modify them using excel 2007 and then save the files in the default 2007 file format.

    Is there a way to force the sheet to be saved in Excel 2003 format, thus preserving my macros (maybe using a Workbook_BeforeSave subroutine)?

    Thanks.

  2. #2
    Registered User
    Join Date
    12-04-2007
    Posts
    26
    I came up with the following, hope someone finds it useful:

    Please Login or Register  to view this content.
    Last edited by urungus; 08-28-2008 at 06:33 PM.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    That's a little hostile; it doesn't allow the user to save the workbook in 2007 format at all.

    You might instead do the save the user want to do, and then do SaveCopyAs.

  4. #4
    Registered User
    Join Date
    12-04-2007
    Posts
    26
    I don't want them to be able to save in Excel 2007 format because it strips out the macros and then the next person working on the file doesn't have the required functionality.

    However there is a bug in the above code if the user makes changes to the file and attempts to close the file without saving first. The expected "do you want to save the changes you have made" dialog box pops up, but if the user chooses "yes" and saves the file, the same dialog box will pop up again (and again) until the user chooses to cancel.

    I believe this is happening because I set Cancel to true at the end. But I need to do so for a normal save, because otherwise the file will be saved a second time after the routine is finished. Any advice?

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    I don't know what you're trying to do.

    If you want to ensure that there is always a post-review copy in xls format by the original file name, then store the original workbook name and path (FullName property) in a public variable in the Open event, and save by that name in addition to whatever is the user is doing in the Save event. You could also save as an xlsm in every save as well.

    I just wouldn't keep the user from doing what they want to do.

    You can also test SaveAsUI to see if the event was triggered by the user doing a File > Save As ...

    But I'd just ask the user to do Save rather than SaveAs. Excel opens 2003 files in compatibility mode, and they have to do something willful to save as a 2007 workbook.

  6. #6
    Registered User
    Join Date
    12-04-2007
    Posts
    26
    I don't know what you're trying to do.
    I'm trying to force the file to be saved in .xls format.

    We have several people collaborating on the file, some of whom use Excel 2007 and some who use 2003. Sometimes, despite telling them not to, and despite the file being opened in compatibility mode, the people updating the file save it in Excel 2007 format.

    This causes several headaches:

    1) The spreadsheet relies heavily on behind-the-scenes macros. They are stripped out when saved in Excel 2007 format, rendering the updated file practically useless.

    2) The converters that allow Excel 2007 files to be read into Excel 2003 do not work reliably for us.

    Thus, any time a save is attempted, whether via menu command save/save as, or because an unsaved file is being closed, I want to make sure the file is being saved in its original Excel 2003 format (.xls).

    I've got the save/save as working but there is still the quirk described above when closing an unsaved file.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Again,

    If you want to ensure that there is always a post-review copy in xls format by the original file name, then store the original workbook name and path (FullName property) in a public variable in the Open event, and save by that name in addition to whatever is the user is doing in the Save event. You could also save as an xlsm in every save as well.

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Quote Originally Posted by urungus View Post
    The macros I have embedded in my excel files are being stripped out when my coworkers modify them using excel 2007 and then save the files in the default 2007 file format.

    Is there a way to force the sheet to be saved in Excel 2003 format, thus preserving my macros (maybe using a Workbook_BeforeSave subroutine)?

    Thanks.
    That cannot be happening with a save, especially if they save as *.xlsm .

    Please post in the correct Forum, I am moving this to the 2007 Forum
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  9. #9
    Valued Forum Contributor ratcat's Avatar
    Join Date
    03-07-2008
    Location
    Rural NSW, Australia
    MS-Off Ver
    Vista 2007
    Posts
    1,111
    Quote Originally Posted by urungus View Post
    The macros I have embedded in my excel files are being stripped out when my coworkers modify them using excel 2007 and then save the files in the default 2007 file format.

    Is there a way to force the sheet to be saved in Excel 2003 format, thus preserving my macros (maybe using a Workbook_BeforeSave subroutine)?

    Thanks.
    G'day

    Suggestion.

    Go to the machines that have 2007 change the following settings.

    The setting will default the 2007 to save in 2003 mode without adjusting any setting when saving.

    Go to the Office button > Excel Options > Save > then change the setting 'Save files in this format:' to Excel 97-2003 Workbook.

    Then click on 'ok'.

    Hope that helps
    Have I made you happy ??? If yes, please make me happy by pressing the http://www.excelforum.com/images/buttons/reputation-40b.png Add Reputation button in my post.
    Please don't forget to do the same to other contributors of this forum.

    Thanks
    I don't void confusion, I create it

+ 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. Force file name format
    By Dude101 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-16-2008, 08:50 AM
  2. Save As cell format problem
    By Jumpy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-19-2007, 03:33 AM
  3. Force cell date format
    By Macdave_19 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-20-2007, 04:07 PM
  4. .xla file saves itself as .xls file format
    By cmw001 in forum Excel General
    Replies: 1
    Last Post: 07-24-2007, 09:09 AM
  5. Save file, create .pdf, (Now delete .xls file)
    By daniels012 in forum Excel General
    Replies: 4
    Last Post: 03-30-2007, 05:14 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