Sub SaveAsPDF()
' Get the path of the current workbook
Dim path As String
path = ThisWorkbook.Path & "\"
' Create a new folder with the current date and time as the name
Dim folderName As String
folderName = Format(Now(), "yyyy-mm-dd_hh-mm-ss")
MkDir path & folderName
' Save the current worksheet as a PDF in the new folder
Dim fileName As String
fileName = folderName & "\" & "MyWorksheet.pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=path & fileName
' Display a message box to confirm the save
MsgBox "PDF saved in folder: " & path & folderName
End Sub