Re: how to open a Workbook and activate a specific ***

From: Bigwheel (dave_at_bigwheel49.fsnet.co.uk)
Date: 08/17/04


Date: Tue, 17 Aug 2004 21:04:40 +0100


> I have a situation... where I have to open workbook1 which has 10 sheets
> (sheet1...sheet10) from another workbook2 using different commandbuttons.
> The question is how do I open workbook1 and activate different sheets
based
> on the command button. Is there anyway to pass the *** name as an
argument.
> or Are there any other methods? My workbook1 does have an auto_open macro.

One way would be to have radio buttons in workbook2 which store the index of
the selected button in a cell
then when the Load Workbook command button is clicked it will open the
desired workbook and select the
*** specified.

This code run from the command button ...

Sub Button1_Click()
    Dim sheetnum
    sheetnum = [a1]
    Workbooks.Open Filename:="TestBook1.xls"
    Sheets("Sheet" & sheetnum).Select

End Sub