+ Reply to Thread
Results 1 to 20 of 20

SaveAs, Error.

  1. #1
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    SaveAs, Error.

    I am getting an error after saving a workbook,

    Error opening file: "The file format differs from the format that the file name extension specifies"
    I save the book as an ".xlsx" file and when I go to open it up it prompts me for this error. I click open anyway and I am greated with a blank file. No grid just the tool bar.

    Any ideas?
    Last edited by JapanDave; 08-28-2016 at 07:54 AM.
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  2. #2
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: SaveAs, Error.

    Nothing????

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: SaveAs, Error.

    Try exporting the workbook to the same extension of original workbook ..
    You may have corrupted export process for the workbook ..
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  4. #4
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: SaveAs, Error.

    It is a completely new workbook create via code.

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: SaveAs, Error.

    Can you post the code used to examine it?

  6. #6
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: SaveAs, Error.

    double post.
    Last edited by JapanDave; 08-27-2016 at 07:05 AM.

  7. #7
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: SaveAs, Error.

    OK, this creates and closes the file.
    Please Login or Register  to view this content.
    Don't know if that helps any?
    Last edited by JapanDave; 08-27-2016 at 07:19 AM.

  8. #8
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: SaveAs, Error.

    This is not VBA code ..!!!

  9. #9
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: SaveAs, Error.

    @YasserKhalil , I didn't say it was. But the fact remains that I have this problem when opening the file.

  10. #10
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: SaveAs, Error.

    Hi JapanDave (good to see you again )
    Just as a guess, maybe
    Please Login or Register  to view this content.
    instead of
    Please Login or Register  to view this content.

  11. #11
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: SaveAs, Error.

    @nilem, You too,

    But , my code already does that,

    Please Login or Register  to view this content.

  12. #12
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: SaveAs, Error.

    I meant to exclude Application statement from Excel.Workbook workBook = excelxl.Application.Workbooks.Add();

  13. #13
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: SaveAs, Error.

    Please Login or Register  to view this content.
    I save the book as an ".xlsx"
    You're adding a code module to a new blank workbook, and then saving it with an xlsx extension. Xlsx files can't contain code, so I'd expect Excel to be surprised.

    It's the same result you'd expect if you renamed an xlsm file to xlsx.
    Last edited by shg; 08-27-2016 at 01:15 PM.
    Entia non sunt multiplicanda sine necessitate

  14. #14
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: SaveAs, Error.

    @shg, Crap, I forgot to delete the module, that fixed it.

    @nilem, OK, I see what you mean. As I said above it was the code module not being removed.

    Thanks Guys!

  15. #15
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: SaveAs, Error.

    how come you don't save the workbook explicitly using the file name? then you could specify the format too
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  16. #16
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: SaveAs, Error.

    @JosephP, I was doing that, but dropped the extension so as to save the excel file that is native to the office version that the user is using.

    And that has me thinking, if you specify the extension as say an ".xlsx" won't any code module be automatically dropped?

  17. #17
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: SaveAs, Error.

    only if you specify the correct fileformat parameter

  18. #18
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: SaveAs, Error.

    Well, deleteing the module did not work. Still getting the same error. This is frustrating. Also, it only happens on Windows 7 machines. Windows 8 and above does not cause this error.

  19. #19
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: SaveAs, Error.

    Still getting this issue, no matter what format it is saved under it creates a corrupted file.

    So, I thought screw it, I will save it in PDF format, as I am only making the file so it can be printed out in the format I want.

  20. #20
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: SaveAs, Error.

    Well I figured out what has been happening. When after saving the file and closed it, I had released all the objects, but it was leaving a background process running, which was linked to a now closed file and therefore not allowing anything else to open. And anything that was opened was met with different file error. So I had to loop through all the process ID's of the current running excel processes and find the one that should not be there and kill it.

    This seems to be a Com Object related issue with Excel Interop. Deffinately not a typical issue with releasing Com Objects in C#,but in certain situation can cause this kind of issue.

+ 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] Run-time error '91' when .SaveAS
    By plans in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-06-2016, 07:29 PM
  2. [SOLVED] .SaveAs error for Word (Error 4198: Command Failed)
    By hoboken in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-24-2015, 06:53 PM
  3. [SOLVED] SaveAs 1004 Error
    By Stevo56 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-01-2014, 11:14 AM
  4. [SOLVED] SaveAS Error
    By tigerdel in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-26-2012, 09:24 AM
  5. [SOLVED] error with saveas....
    By jeramie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-13-2006, 06:45 AM
  6. SaveAs causes 0x800A03EC error
    By Justin Young in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-25-2005, 02:06 PM
  7. error message with saveas
    By DJA in forum Excel General
    Replies: 6
    Last Post: 02-18-2005, 10:06 AM

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