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" <steve@discussions.microsoft.com> wrote in message
> news:0082894A-F3BD-4EF9-8F54-F8304CD17A76@microsoft.com...
> > 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
> >
>
>
>
Bookmarks