+ Reply to Thread
Results 1 to 3 of 3

Saving Excel Files to Correct Format with Macro

  1. #1
    Registered User
    Join Date
    10-04-2009
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    77

    Saving Excel Files to Correct Format with Macro

    I have a macro which copies a sheet to a new workbook and then saves the workbook and attaches it to an e-mail.

    When I open the attachment in the e-mail, it shows the following error:

    "the file that you are trying to open is in a different format than specified by the
    file extension. Verify that the file is not corrupted and is from a trusted source before
    opening the file. Do you want to open the file now?"

    When I click "yes" to open the file, the file is fine. However, when the email is sent to customers, the error scares them a bit and a lot of them do not wish to open the file.

    My code is as follows:

    Please Login or Register  to view this content.
    Thanks in advance
    Last edited by Smurlos; 03-09-2010 at 06:48 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    08-23-2009
    Location
    Hampshire, UK
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    328

    Re: Saving Excel Files to Correct Format with Macro

    I'm not sure what version of Excel you're using - is it 2007? If so, the file extension should be .xlsx or .xlsm. If you rename a .xlsx file with a .xls extension you will get the error message shown when you try to open it.

    To save the file as Excel 2003 add FileFormat :=xlExcel8 to the Save As line
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-04-2009
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    77

    Re: Saving Excel Files to Correct Format with Macro

    Quote Originally Posted by Huron View Post
    I'm not sure what version of Excel you're using - is it 2007? If so, the file extension should be .xlsx or .xlsm. If you rename a .xlsx file with a .xls extension you will get the error message shown when you try to open it.

    To save the file as Excel 2003 add FileFormat :=xlExcel8 to the Save As line
    Please Login or Register  to view this content.
    Thanks for your help

+ 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