MalcolmGill
New Member
- Joined
- Aug 9, 2019
- Messages
- 12
Hi guys
I want to save a single worksheet from a .xlsm workbook to a new .xls workbook, overwriting any version already saved without alerts. I think what I've got is OK but I'd appreciate any words of wisdom from you.
Sub SaveAs(grpID As String)
Dim fName As String
Dim fPath As String
Dim newBook As Workbook
fPath = "C:\U3A Registers"
fName = grpID & " Register.xls"
Set newBook = Workbooks.Add
ThisWorkbook.Sheets("Proforma1").Copy Before:=newBook.Sheets(1)
Application.DisplayAlerts = False
newBook.SaveAs Filename:=fPath & "" & fName, FileFormat:=56
Application.DisplayAlerts = True
Workbooks(fName).Close
End Sub
I want to save a single worksheet from a .xlsm workbook to a new .xls workbook, overwriting any version already saved without alerts. I think what I've got is OK but I'd appreciate any words of wisdom from you.
Sub SaveAs(grpID As String)
Dim fName As String
Dim fPath As String
Dim newBook As Workbook
fPath = "C:\U3A Registers"
fName = grpID & " Register.xls"
Set newBook = Workbooks.Add
ThisWorkbook.Sheets("Proforma1").Copy Before:=newBook.Sheets(1)
Application.DisplayAlerts = False
newBook.SaveAs Filename:=fPath & "" & fName, FileFormat:=56
Application.DisplayAlerts = True
Workbooks(fName).Close
End Sub