Hi all
I am very new to VB and its mostly thanks to forums like this and a bit of internet searching.
I have a Run-time error 424 - Object required issue
Let me explain what I'm doing:
I have a commandButton that actions SaveAs PDF
The one button has to only export 2 specific sheets to PDF
The msgbox pops up and is giving me the correct filename (which I have selected)
But when I say save after that it ends with the runtime error - I am presuming its the sheets (array argument
Please can someone look at this for me and tell me what I am doing wrong:
Private Sub CommandButton2_Click()
answer = msgbox("Do you want to export the quotation to PDF?", vbYesNo + vbQuestion, "Export Quotation to PDF")
If answer = vbYes Then
filesSaveName = Application.GetSaveAsFilename(Sheet49.Range("N13"), fileFilter:="PDF(*.pdf),*.pdf")
If fileSaveName <> True Then
Sheets(Array("AutoRate Quote Form", "Excess Sheet")).Select
ActiveSheets.ExportAsFixedFormat Type:=xlTypePDF, filename:=fileSaveName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
End If
End If
End Sub
Thanks in advance
I am very new to VB and its mostly thanks to forums like this and a bit of internet searching.
I have a Run-time error 424 - Object required issue
Let me explain what I'm doing:
I have a commandButton that actions SaveAs PDF
The one button has to only export 2 specific sheets to PDF
The msgbox pops up and is giving me the correct filename (which I have selected)
But when I say save after that it ends with the runtime error - I am presuming its the sheets (array argument
Please can someone look at this for me and tell me what I am doing wrong:
Private Sub CommandButton2_Click()
answer = msgbox("Do you want to export the quotation to PDF?", vbYesNo + vbQuestion, "Export Quotation to PDF")
If answer = vbYes Then
filesSaveName = Application.GetSaveAsFilename(Sheet49.Range("N13"), fileFilter:="PDF(*.pdf),*.pdf")
If fileSaveName <> True Then
Sheets(Array("AutoRate Quote Form", "Excess Sheet")).Select
ActiveSheets.ExportAsFixedFormat Type:=xlTypePDF, filename:=fileSaveName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
End If
End If
End Sub
Thanks in advance