PDF export in solidworks (How to choose certain sheets to export)

I am trying to export solidworks drawings as pdfs and have the ability as long as I export the drawing and all the sheets.

I would like the ability to only export certain sheets, by choosing the sheets from a listbox in the property manager.

The sheets show up in the list but only on loading of the add-in after that they won't refresh.  Here's the code

swModel = SwApp.ActiveDoc

swExportData = SwApp.GetExportFileData(1)

swCusPropMgr = swModel.Extension.CustomPropertyManager(

"")

swDraw = swModel

vSheetNames = swDraw.GetSheetNames()

If swModel Is Nothing Then

MsgBox(

"No current document", MsgBoxStyle.Critical)

Exit Sub

End If

If swModel.GetType <> 3 Then

MsgBox(

"Drawings only please!", MsgBoxStyle.Critical)

Exit Sub

End If

swModelDocExt = swModel.Extension

filename = swModel.GetPathName

If filename = "" Then

MsgBox(

"Please save the file first and try again", MsgBoxStyle.Critical)

Exit Sub

End If

'Get filename from path

path = InStrRev(filename,

"\")

fullpath = Len(filename)

trimpath = fullpath - path

filename = Microsoft.VisualBasic.Right(filename, trimpath)

filename = UCase(Microsoft.VisualBasic.Left(filename, Len(filename) - 7))

If Res = vbYes Then

Exit Sub

End If

'Get Revision

Dim retVal As Object

retVal = swCusPropMgr.Get3(

"Revision", False, rev, trueRev)

If rev = "" Then

rev =

"-"

End If

'Set PDF options

SwApp.SetUserPreferenceToggle(323, False)

SwApp.SetUserPreferenceToggle(325, False)

SwApp.SetUserPreferenceToggle(326, False)

SwApp.SetUserPreferenceToggle(327, True)

SwApp.SetUserPreferenceToggle(324, True)

'Create file

Dim boolstatus As Boolean

boolstatus = swExportData.SetSheets(1, 1)

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

If boolstatus Then

MsgBox(FinalMessage, MsgBoxStyle.Information,

"Success!")

Else

MsgBox(

"Save as PDF failed, Error code:" & lErrors)

end if

SolidworksApi macros