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: 1
Default Printing specific excel worksheets in VB.NET

Hi,

I feel like this should be obvious, but I'm missing something. I want
to print specific worksheets in an Excel workbook (ie, sheets 1 through
7 of a 13 sheet book). I want them to go out as one print job, not 7
separate print jobs. I tried "selecting" sheets one through seven, but
all the other sheets default to "selected" when I open the workbook, so
the print job always prints all 13 sheets (code below). I havent found
a way to "unselect" sheets (setting the select property to false give
me an error). Any help would be much appreciated. Thanks.

ECD

Dim xlApp As New Microsoft.Office.Interop.Excel.Application
Dim xlBook As Microsoft.Office.Interop.Excel.Workbook
Dim SelectedSheets(6) As Integer

'Open excel sheet, load data
xlBook = CType(xlApp.Workbooks.Add, _
Microsoft.Office.Interop.Excel.Workbook)

xlBook = OpenExcelWorkBook(xlApp)

SelectedSheets(0) = 1
SelectedSheets(1) = 2
SelectedSheets(2) = 3
SelectedSheets(3) = 4
SelectedSheets(4) = 5
SelectedSheets(5) = 6
SelectedSheets(6) = 7

xlBook.Sheets(SelectedSheets).Select()
xlBook.PrintOut()

xlBook.Close(False)
xlBook = Nothing
xlApp.Quit()
xlApp = Nothing

 
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
Excel - printing specific areas Gabriella Excel Discussion (Misc queries) 2 July 24th 08 04:29 PM
Printing Excel Worksheets Justme 61 Excel Discussion (Misc queries) 1 April 4th 08 10:07 PM
Limit Printing on specific worksheets in Excel [email protected] Excel Discussion (Misc queries) 2 May 28th 07 01:48 PM
Printing Specific data from Excel worksheet Newtonboy Excel Discussion (Misc queries) 6 July 5th 06 10:23 AM
printing worksheets in Excel BGA Excel Discussion (Misc queries) 1 February 17th 05 03:24 PM


All times are GMT +1. The time now is 03:46 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"