minimize just opened workbook window

G

Guest

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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top