Storyteller
Instructor
Hello All,
I have a form that allows the users to select (via checkbox) which sheets they would like to combine into one pdf output. As my title says I am getting an "Error 9 - subscript out of range" error. Any help would be greatly appreciated.
I have a form that allows the users to select (via checkbox) which sheets they would like to combine into one pdf output. As my title says I am getting an "Error 9 - subscript out of range" error. Any help would be greatly appreciated.
Code:
Private Sub cmdPDF_Click()
'On Error Resume Next
Dim strPDF As String
Dim ClientName As String
Dim ClientFilename As Variant
ClientName = Range("Client_First") & Range("Client_LasT")
'Non Reg Client
If Me.chkNonRegClient = True Then
strPDF = strPDF & """Non_Reg_Client""" & ", "
End If
'Non Reg Spouse
If Me.chkNonRegSpouse = True Then
strPDF = strPDF & """Non_Reg_Spouse""" & ", "
End If
'TFSA Client
If Me.chkTFSAClient = True Then
strPDF = strPDF & """TFSA_Client""" & ", "
End If
'TFSA Spouse
If Me.chkTFSASpouse = True Then
strPDF = strPDF & """TFSA_Spouse""" & ", "
End If
'RRSP/RRIF Client
If Me.chkRRSPRRIFClient = True Then
strPDF = strPDF & """RRSP_RRIF_Client""" & ", "
End If
'RRSP/RRIF Spouse
If Me.chkRRSPRRIFSpouse = True Then
strPDF = strPDF & """RRSP_RRIF_Spouse""" & ", "
End If
'Locked/LIF Client
If Me.chkLockedLIFClient = True Then
strPDF = strPDF & """Locked_LIF_Client""" & ", "
End If
'Locked/LIF Spouse
If Me.chkLokcedLIFSpouse = True Then
strPDF = strPDF & """Locked_LIF_Spouse""" & ", "
End If
'Investment Account Summary
If Me.chkIAS = True Then
strPDF = strPDF & """InvestmentAccountSummary""" & ", "
End If
'Deposit/Withdrawal Summary
If Me.chkDWDSummary = True Then
strPDF = strPDF & """Dep_WD_Summary"""
End If
'Save selected worksheets as a PDF
ClientFilename = Application.GetSaveAsFilename( _
InitialFileName:=ClientName, _
filefilter:="PDF, *.pdf", _
Title:="Save As PDF")
Sheets(Array(strPDF)).Select
Selection.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=ClientFilename, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End Sub