View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default minimize just opened workbook window

A couple of things... wkbook2 is pointing at a range and not at the workbook
as you might expect it is. Secondly when you open a workbook it is opened in
the active window so to hide it you just need ActiveWindow.WindowState =
xlMinimized. Give this a try...

Dim wkbook2 as Workbook
Workbook.Open (Range("book2").Value)
Set wkbook2 = ActiveWorkbook
ActiveWindow.WindowState = xlMinimized

--
HTH...

Jim Thomlinson


"JohnZ" wrote:

In an Open event subroutine for "workbook1", I open a second workbook
"workbook2" that is defined by label "book2" in a "workbook1" worksheet with
the following statements:

Dim wkbook2 as object
Set wkbook2 = Range("book2")
Workbook.Open (wkbook2)

Question: How do I minimize (xlMinimize) the window for the just opened
"workbook2" using the label "book2" defined in "workbook1"?

Workbooks(wkbook2).ActiveWindow.WindowState = xlMinimized

Above statement does not work.