Solved

XLSM File corrupting when saving

Posted on 2013-11-06
3
340 Views
Last Modified: 2013-11-11
Hi,

I have a heavy .XLXM file with macros created in Excel 2010. When saving the same file in 2007, it says it has an issue with number of rows and shows the compatibility box. (I checked the rows at this point and it shows 1 million rows compared to 65,000)

When I suppress that and save it, it corrupts the file and the file can never be opened.

The saving is done by macro via this code

   
    ActiveWorkbook.SaveAs Filename:="\\Fileserver\Everyone\CDI " + bName + "\CP Batch Files\" & fName, FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False

Open in new window


What am I doing wrong here? I think above is the culprit (especially the fileformat)

Should I use (xlOpenXMLWorkbookMacroEnabled?)

This never happened to other files.


PS: There is a procedure in the file which saves one of the tab as Excel 2003 version (for uploading into a program) However, this procedure was never triggered. Here is the code that is used in that procedure.

        ActiveWorkbook.SaveAs pName & fName & ".xls", FileFormat:=56

I am includnig this because this code is the only thing that connects anywhere to the row issues excel might have. Everything else is kept as it is.

Any help in right direction is appreciated!
0
Comment
Question by:Shanan212
  • 2
3 Comments
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
I assume that the great majority of the million rows are blank. If that's the case just delete them in 2010 and re-save it.
0
 
LVL 13

Author Comment

by:Shanan212
Comment Utility
Are you saying just select the rows (lets say from row 10,000 till the million) and delete on every sheet?


Also whats the correct fileformat to save as xlsm (2010) version? What I have highlighted below is correct?

    ActiveWorkbook.SaveAs Filename:="\\Fileserver\Everyone\CDI " + bName + "\CP Batch Files\" & fName, FileFormat:= _
        xlOpenXMLWorkbookMacroEnabled, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
0
 
LVL 45

Accepted Solution

by:
Martin Liss earned 500 total points
Comment Utility
Yes to both.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now