Hello,
I have a VBA script that saves my active workbook into a folder called S1, but I want to change it to only to save a worksheet named Order1 to the same S1 folder.
I also don't want the original workbook to close, only the one I just saved.
Any help would be appreciated.
Sub SaveMe()
Dim filename101 As String
Dim path101 As String
Dim fso As Object
Application.DisplayAlerts = False
Set fso = CreateObject("Scripting.FileSystemObject")
path101 = Environ("UserProfile") & "\Orders\S1\"
If Not fso.FolderExists(path101) Then
MsgBox "The folder " & path101 & " doesn't exist.", vbExclamation
Exit Sub
End If
filename101 = "Order1 " & Range("B5").Value & ".xlsx"
ActiveWorkbook.SaveAs path101 & filename101, xlOpenXMLWorkbook
Application.DisplayAlerts = True
End Sub
I have a VBA script that saves my active workbook into a folder called S1, but I want to change it to only to save a worksheet named Order1 to the same S1 folder.
I also don't want the original workbook to close, only the one I just saved.
Any help would be appreciated.
Sub SaveMe()
Dim filename101 As String
Dim path101 As String
Dim fso As Object
Application.DisplayAlerts = False
Set fso = CreateObject("Scripting.FileSystemObject")
path101 = Environ("UserProfile") & "\Orders\S1\"
If Not fso.FolderExists(path101) Then
MsgBox "The folder " & path101 & " doesn't exist.", vbExclamation
Exit Sub
End If
filename101 = "Order1 " & Range("B5").Value & ".xlsx"
ActiveWorkbook.SaveAs path101 & filename101, xlOpenXMLWorkbook
Application.DisplayAlerts = True
End Sub