(code originally discussed and tweaked on the 10th October and called Looping through all sheets except first 2)
This code below appears to be working fine and is saving the workbook with the correct extension and when you view it in My Documents it is shown with the correct picture, suffix etc, but when I open the file from My Documents, I get the following message.
"The file you are trying to open is is a different format to that supplied by the file extension. Verify that the file is not corrupted and from a trusted location" Although it then opens fine, it is causing a problem as the file is supposed to be read by another application and it cannot open the file as it cannot acknowledge the error message.
I have tried saving the file in all versions of Excel, but the same thing always occurs.
Can anyone suggest a way I can avoid this error message appearing.
Many thanks
This code below appears to be working fine and is saving the workbook with the correct extension and when you view it in My Documents it is shown with the correct picture, suffix etc, but when I open the file from My Documents, I get the following message.
"The file you are trying to open is is a different format to that supplied by the file extension. Verify that the file is not corrupted and from a trusted location" Although it then opens fine, it is causing a problem as the file is supposed to be read by another application and it cannot open the file as it cannot acknowledge the error message.
I have tried saving the file in all versions of Excel, but the same thing always occurs.
Can anyone suggest a way I can avoid this error message appearing.
Many thanks
Code:
Sub CreateNewWorkBook()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim x As Integer
Dim j As Long
Dim s As String
j = Worksheets.Count
For x = 4 To j
s = Worksheets(x).Name
Worksheets(x).Copy
With ActiveWorkbook
.SaveAs Filename:="C:\Documents and Settings\User\Desktop\Files for printing\" & s & ".csv"
.Close
End With
Next x
Application.CutCopyMode = False
End Sub