Help: Export drawing to PDF, only certain sheets

I am writing a macro to export all sheets except for one that's called "FLAT" to a PDF file.   I took some sample code from the API help.


Everything works until I get to creating a new array called "varPrint".   I don't use arrays I suspect I am using that variable incorrectly.

Option Explicit

    Dim swApp               As SldWorks.SldWorks

    Dim swModel             As SldWorks.ModelDoc2

    Dim swDrawDoc           As SldWorks.DrawingDoc

    Dim swModelDocExt       As SldWorks.ModelDocExtension

    Dim swExportPDFData     As SldWorks.ExportPdfData

    Dim boolstatus          As Boolean

    Dim filename            As String

    Dim lErrors             As Long

    Dim lWarnings           As Long

    Dim strSheetName(4)     As String

    Dim varSheetName        As Variant

    Dim varPrint(2)            As Variant

    Dim i                   As Integer

    Dim count               As Integer

Sub main()

    ' Path to which to save PDF file of drawing

    filename = "C:\test.PDF"

    Set swApp = Application.SldWorks

    swApp.Visible = True

    ' Open specified drawing

    Set swModel = swApp.OpenDoc6("C:\test.SLDDRW", swDocDRAWING, swOpenDocOptions_Silent, "", lErrors, lWarnings)

'    Set swModelDocExt = swModel.Extension

    Set swDrawDoc = swModel

    varSheetName = swDrawDoc.GetSheetNames

    count = swDrawDoc.GetSheetCount

    For i = 0 To count - 1

        If varSheetName(i) <> "FLAT" Then

            varPrint(i) = varSheetName(i)

        End If

        'MsgBox varSheetName(i)

    Next i

    Set swExportPDFData = swApp.GetExportFileData(3)

'    If swExportPDFData Is Nothing Then MsgBox "Nothing"

'

    boolstatus = swExportPDFData.SetSheets(swExportData_ExportSpecifiedSheets, varPrint)

'

'

boolstatus = swModelDocExt.SaveAs(filename, 0, 0, swExportPDFData, lErrors, lWarnings)

End Sub

SolidworksApi macros