When trying to run the below I get the following error:
"This extension can not be used with the selected file type. Change the file extension in the file name text box or select a different file type by changing the save as type."
Code:
Dim strPath As String
Dim strFolderPath As String
strFolderPath = "Y:\
strPath = strFolderPath & _
Sheet1.Range("A1").Value & _
Sheet1.Range("B1").Value & ".xlsx"
ActiveWorkbook.SaveAs Filename:=strPath
The error means that the ActiveWorkbook is trying to save as a different file format then ".xlsx". To force it to save as .xlsx, you also have to pass the fileformat.
ActiveWorkbook.SaveAs Filename:=strPath, FileFormat:=xlOpenXMLWorkbook
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With