Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a program that runs from Access which opens an Excel workbook,
plugs a value (from Access) into the first cell of a worksheet called "Tables," and then publishes a PDF containing between 1 and 4 worksheets selected by the user in an Access list box. The code below worked like a charm at first, but all of a sudden it has started including in the PDF the "Tables" worksheet in addition to the worksheets selected in the list box. I can't seem to find an easy way to deselect the "Tables" worksheet before selecting the desired worksheets. Can you?? Here's my code: 'Plug in the selected SchoolID in the first cell of the Tables tab in the master file objReport.Worksheets("Tables").Range("A1").Value = strCode 'Select the each worksheet selected in the Subjects list box If lstSubjects.ItemsSelected.Count = 0 Then MsgBox "PDFs cannot be produced because no worksheets have been selected by the user." Else 'In the open Excel workbook, select each worksheet selected by the user in the lstSubjects listbox. For Each varItem In lstSubjects.ItemsSelected Worksheets(lstSubjects.ItemData(varItem)).Select (False) Next 'Produce a PDF containing those for worksheets, saving it to the specified folder. objReport.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _ FileName:=strPath, _ Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _ :=False, OpenAfterPublish:=False End If |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
deselect chart | Excel Programming | |||
Deselect Row in ListBox | Excel Programming | |||
select all, deselect these | Excel Discussion (Misc queries) | |||
List box deselect | Excel Programming | |||
ActiveChart.Deselect won't Deselect | Charts and Charting in Excel |