LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Deselect a worksheet?

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
deselect chart MikeF[_2_] Excel Programming 2 January 22nd 10 06:02 AM
Deselect Row in ListBox Ryan H Excel Programming 1 March 11th 09 07:22 PM
select all, deselect these md[_2_] Excel Discussion (Misc queries) 1 March 2nd 08 03:08 PM
List box deselect comparini3000 Excel Programming 2 June 14th 06 03:31 PM
ActiveChart.Deselect won't Deselect Mark Stephens Charts and Charting in Excel 2 June 16th 05 02:54 AM


All times are GMT +1. The time now is 12:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"