mij nivek
mij nivek

Reputation: 81

How will I get rid of this error messages?

I would like to ask how to get rid of this error notification? Please see picture attached.

I am using this VBA Code:

  Sub Sample()
'~~> Change Sheet1 to the relevant sheet
'~~> This will create a new workbook with the relevant sheet
ThisWorkbook.Sheets("Fuels_Slips_Issued").Copy

'~~> Save the new workbook
ActiveWorkbook.SaveAs "C:\book1.xlm", FileFormat:=xlOpenXMLWorkbook
 End Sub

This a screen grab with the error code

Upvotes: 0

Views: 39

Answers (1)

user10981853
user10981853

Reputation:

An XLM is not a FileFormat:=xlOpenXMLWorkbook. Omit the extenstion and let the FileFormat argument add the correct extension.

ActiveWorkbook.SaveAs Filename:="C:\book1", FileFormat:=xlOpenXMLWorkbook 'XLSX type

For a complete list of FileFormat types, see xlFileFormat enumeration.

Upvotes: 1

Related Questions