• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

file format error message

ysherriff

Member
Hello,

I have the following code created in excel 2007 but the file is saved in excel 97-2003 format:


reportName = fileNamePrefix & " - " & currMthStr & " - " & psrFirstNameStr & " " & psrLastNameStr & ".xls"

I believe the error comes from the below code where I copy and paste certain sheets into a new workbook.:

Sheets(Array("PSR TEMPLATE CONTROL", "PSR CALCULATOR")).Copy
On Error GoTo 0

' Copy sheets
' Remove External Links, Hperlinks
' Make sure A1 is selected on all sheets
For Each ws In ActiveWorkbook.Worksheets
ws.Cells.Copy
ws.Cells.Hyperlinks.Delete
Application.CutCopyMode = False
Cells(1, 1).Select
ws.Activate
Next ws
Cells(1, 1).Select


Can it be that when you copy and paste into a new workbook and the workbook format is different, you get this error message? But how can that be if my report name has the correct extension format?

Thanks for your help.
 
There is a problem that can pop-up when you change formats due to the different size of worksheets in 2007 vs 2003. Could that be what you are running into?
 
Thank you Hui. I found a workaround. I did not use the copy sheet command. I just copied the ranges into the template instead.

I appreciate your help.
 
Back
Top