1
votes

This is the line in my code: ActiveWorkbook.SaveAs Filename:=curPath & cell.Value & Format(Now, "dmmmyyyy" & ".xlsx"), FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

Here's the extension from a couple of the files: .xl47x .xl35x

I tried using ".xlsm" and I got: .xl78 .xl22

I can force change the name and then the file will open - but why is it changing the extension? Does someone know what is going on? I've never seen this. Thank you!

1

1 Answers

1
votes

Your file extension in the code needs to be outside the Format function. See the suggested approach below.

ActiveWorkbook.SaveAs Filename:=curPath & cell.Value & Format(Now, "dmmmyyyy") & ".xlsx", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False