Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default How do I select multiple worksheets for print preview?

In VBA one can select multiple worksheets by passing an array. How is this
same thing accomplished using C#?

I would like to select a number of worksheet from the entire workbook for a
print preview. Thus having only the selected worksheets appear in the
preview.
The following shows the entire workbook.

objExcel.Worksheets.PrintPreview(Missing.Value);

Steve

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How do I select multiple worksheets for print preview?

You would have to select the sheets, but then

objExcel.Activewindow.SelectedSheets.PrintPreview( Missing.Value);

I would think.

--
Regards,
Tom Ogilvy

"steve" wrote in message
...
In VBA one can select multiple worksheets by passing an array. How is

this
same thing accomplished using C#?

I would like to select a number of worksheet from the entire workbook for

a
print preview. Thus having only the selected worksheets appear in the
preview.
The following shows the entire workbook.

objExcel.Worksheets.PrintPreview(Missing.Value);

Steve



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default How do I select multiple worksheets for print preview?

Thank you for your reponse. It was helpful in printing one selected sheet.
However, I do not know how to programmaticaly select multiple sheets. Also,
I am using Excel 2000.

I have tried:

string[] stuff = {"Raw Data", "Inventory"};
objSheets.get_Item(stuff);
objExcel.ActiveWindow.SelectedSheets.PrintPreview( Missing.Value);

or

string[] stuff = {"Raw Data", "Inventory"};
objSheets.Select(stuff);
objExcel.ActiveWindow.SelectedSheets.PrintPreview( Missing.Value);

But the PrintPreview command throws an error in each case. PrintPreview was
tried on the Workbook and WorkSheets objects also.

also manually selecting each sheet doesn't work either

(Excel.Worksheet)objExcel.Sheets[2]).Select(Missing.Value);
(Excel.Worksheet)objExcel.Sheets[5]).Select(Missing.Value);
objExcel.ActiveWindow.SelectedSheets.PrintPreview( Missing.Value);

Any ideas?

Thank you

Steve


"Tom Ogilvy" wrote:

You would have to select the sheets, but then

objExcel.Activewindow.SelectedSheets.PrintPreview( Missing.Value);

I would think.

--
Regards,
Tom Ogilvy

"steve" wrote in message
...
In VBA one can select multiple worksheets by passing an array. How is

this
same thing accomplished using C#?

I would like to select a number of worksheet from the entire workbook for

a
print preview. Thus having only the selected worksheets appear in the
preview.
The following shows the entire workbook.

objExcel.Worksheets.PrintPreview(Missing.Value);

Steve




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How do I select multiple worksheets for print preview?

Select takes an optional argument when used with worksheets.

Select the first worksheet as you normally would

then select each of the remainder with an argument of False

The false says not to replace the currently selected sheet, but to add the
referenced sheet to the selected sheets.

you also might try

objSheets(stuff).PrintPreview

(obviously the C# equivalent - I don't know anything about C#).

--
Regards,
Tom Ogilvy

"steve" wrote in message
...
Thank you for your reponse. It was helpful in printing one selected sheet.
However, I do not know how to programmaticaly select multiple sheets.

Also,
I am using Excel 2000.

I have tried:

string[] stuff = {"Raw Data", "Inventory"};
objSheets.get_Item(stuff);
objExcel.ActiveWindow.SelectedSheets.PrintPreview( Missing.Value);

or

string[] stuff = {"Raw Data", "Inventory"};
objSheets.Select(stuff);
objExcel.ActiveWindow.SelectedSheets.PrintPreview( Missing.Value);

But the PrintPreview command throws an error in each case. PrintPreview

was
tried on the Workbook and WorkSheets objects also.

also manually selecting each sheet doesn't work either

(Excel.Worksheet)objExcel.Sheets[2]).Select(Missing.Value);
(Excel.Worksheet)objExcel.Sheets[5]).Select(Missing.Value);
objExcel.ActiveWindow.SelectedSheets.PrintPreview( Missing.Value);

Any ideas?

Thank you

Steve


"Tom Ogilvy" wrote:

You would have to select the sheets, but then

objExcel.Activewindow.SelectedSheets.PrintPreview( Missing.Value);

I would think.

--
Regards,
Tom Ogilvy

"steve" wrote in message
...
In VBA one can select multiple worksheets by passing an array. How is

this
same thing accomplished using C#?

I would like to select a number of worksheet from the entire workbook

for
a
print preview. Thus having only the selected worksheets appear in the
preview.
The following shows the entire workbook.

objExcel.Worksheets.PrintPreview(Missing.Value);

Steve






Reply
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
Select all of a certain column across multiple worksheets Charles Belov New Users to Excel 1 August 25th 09 12:58 AM
Select and print multiple files at one time? kingfishbr Excel Discussion (Misc queries) 0 June 11th 09 12:58 PM
select multiple criteria multiple worksheets koneil Excel Worksheet Functions 1 December 12th 07 04:31 PM
print preview v page break preview SamB Excel Discussion (Misc queries) 0 November 16th 06 05:09 PM
How can simultaneously do a print preview for all worksheets ? Jaye Excel Discussion (Misc queries) 1 August 4th 06 04:29 PM


All times are GMT +1. The time now is 07:29 PM.

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

About Us

"It's about Microsoft Excel"