How would we modify this script to convert the file to .xlsx ?
Sub PDFActiveSheet()
'www.contextures.com
'for Excel 2010 and later
Dim wsA As Worksheet
Dim wbA As Workbook
Dim strTime As String
Dim strName As String
Dim strPath As String
Dim strFile As String
Dim strPathFile As String
Dim MyFile As Variant
On Error GoTo errHandler
Set wbA = ActiveWorkbook
Set wsA = ActiveSheet
'strTime = Format(Now(), "yyyymmdd\_hhMM"
strTime = Format(Now(), "mmmm dd, yyyy\_hhmm AM/PM")
'get active workbook folder, if saved
strPath = wbA.path
If strPath = "" Then
'strPath = Application.DefaultFilePath
strPath = "C:\Users\bthurman\OneDrive - General Glass\1 - Desktop\Quotes"
End If
strPath = strPath & "\"
'replace spaces and periods in sheet name
strName = Replace(wsA.Name, " ", "")
strName = Replace(strName, ".", "_")
strName = Range("D3") & " - " & Range("I7") & " - " & Range("L7")
'create default name for savng file
strFile = strName & "_" & strTime & ".pdf"
strPathFile = strPath & strFile
'use can enter name and
'select folder for file
MyFile = Application.GetSaveAsFilename _
(InitialFileName:=strPathFile, _
fileFilter:="PDF Files (*.pdf), *.pdf", _
Title:="Select Folder and FileName to save")
'export to PDF if a folder was selected
If MyFile <> "False" Then
wsA.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=MyFile, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
'confirmation message with file info
'MsgBox "PDF file has been created: " _
' & vbCrLf _
' & myFile
End If
exitHandler:
Exit Sub
errHandler:
MsgBox "Could not create PDF file"
Resume exitHandler
End Sub
Sub PDFActiveSheet()
'www.contextures.com
'for Excel 2010 and later
Dim wsA As Worksheet
Dim wbA As Workbook
Dim strTime As String
Dim strName As String
Dim strPath As String
Dim strFile As String
Dim strPathFile As String
Dim MyFile As Variant
On Error GoTo errHandler
Set wbA = ActiveWorkbook
Set wsA = ActiveSheet
'strTime = Format(Now(), "yyyymmdd\_hhMM"
strTime = Format(Now(), "mmmm dd, yyyy\_hhmm AM/PM")
'get active workbook folder, if saved
strPath = wbA.path
If strPath = "" Then
'strPath = Application.DefaultFilePath
strPath = "C:\Users\bthurman\OneDrive - General Glass\1 - Desktop\Quotes"
End If
strPath = strPath & "\"
'replace spaces and periods in sheet name
strName = Replace(wsA.Name, " ", "")
strName = Replace(strName, ".", "_")
strName = Range("D3") & " - " & Range("I7") & " - " & Range("L7")
'create default name for savng file
strFile = strName & "_" & strTime & ".pdf"
strPathFile = strPath & strFile
'use can enter name and
'select folder for file
MyFile = Application.GetSaveAsFilename _
(InitialFileName:=strPathFile, _
fileFilter:="PDF Files (*.pdf), *.pdf", _
Title:="Select Folder and FileName to save")
'export to PDF if a folder was selected
If MyFile <> "False" Then
wsA.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=MyFile, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
'confirmation message with file info
'MsgBox "PDF file has been created: " _
' & vbCrLf _
' & myFile
End If
exitHandler:
Exit Sub
errHandler:
MsgBox "Could not create PDF file"
Resume exitHandler
End Sub