Robert Wyatt
Board Regular
- Joined
- Jul 15, 2012
- Messages
- 117
- Office Version
- 2019
- Platform
- Windows
What it mean with get the error when trying to save a file? I know that my workbook is save in this format.
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbookMacroEnabled
Here is the formula I'm using
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbookMacroEnabled
Here is the formula I'm using
VBA Code:
Sub SaveTimeSheetWithNewName()
Dim NewFN As Variant
PostToYTD
PostToSocialSecurityRegister
' Copy Next Pay Period to a new workbook
Dim wbThis As Workbook
Dim wsThis As Worksheet
Dim NewFldr As String
Set wbThis = ThisWorkbook
Set wsThis = wbThis.Worksheets("Time Sheet")
NewFldr = "D:\Time Sheet\Earnings Statements ' <--- Copy in the Address from Explorer"
If Right(NewFldr, 1) <> Application.PathSeparator Then NewFldr = NewFldr & Application.PathSeparator
With wsThis
NewFN = NewFldr & "Pay Period" & " # " & .Range("B13").Value & " - " & Format(.Range("H10"), "mm-dd-yyyy") & ".xlsm"
End With
wbThis.Sheets.Copy
Debug.Print NewFN
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbookMacroEnabled
ActiveWorkbook.Close
End Sub
Last edited by a moderator: