Roy_Excel_Island_Apps
Board Regular
- Joined
- Oct 9, 2018
- Messages
- 76
- Office Version
- 365
- Platform
- Windows
This is my code:
Dim New_file_name
New_file_name = Application.GetSaveAsFilename("Verbruik_LT_" & Format(Now(), "dd-mm-yyyy hh_mm"), "Microsoft Excel Workbook (*.xlsb), *.xlsb")
Set NewBook = Workbooks.Add
Verbruik_LT.UsedRange.Copy
With NewBook.Worksheets("Sheet1").Range("A1")
.PasteSpecial (xlPasteValuesAndNumberFormats)
.PasteSpecial (xlPasteColumnWidths)
.PasteSpecial (xlPasteFormats)
End With
NewBook.SaveAs FileName:=New_file_name
I'm getting error 1004 on the SaveAs. What am I doing wrong?
Thanks!
Dim New_file_name
New_file_name = Application.GetSaveAsFilename("Verbruik_LT_" & Format(Now(), "dd-mm-yyyy hh_mm"), "Microsoft Excel Workbook (*.xlsb), *.xlsb")
Set NewBook = Workbooks.Add
Verbruik_LT.UsedRange.Copy
With NewBook.Worksheets("Sheet1").Range("A1")
.PasteSpecial (xlPasteValuesAndNumberFormats)
.PasteSpecial (xlPasteColumnWidths)
.PasteSpecial (xlPasteFormats)
End With
NewBook.SaveAs FileName:=New_file_name
I'm getting error 1004 on the SaveAs. What am I doing wrong?
Thanks!