Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Minimizing An Excel Workbook 1

Status
Not open for further replies.

SandraF

Programmer
Jan 25, 2001
28
US
I open up a workbook in Escel using the following code in a macr:
Workbooks.Open "D:\DBTest.xls"
Set wbTemp = ActiveWorkbook

I then want to minimize the workbook.

I have tried the following but they have not worked:

ActiveWorkbook.Windowstate = xlMinimize
wbTemp.Windowstate = xlMinimize

Any Helpful hints as to make it work?
 
The WindowState property is for the Application object, not the workbook object.

Application.WindowState = xlMinimized

If you want to hide the the workbook, you could activate the master workbook (the one that contains the macro). You can still use the workbook object (wbTemp).

Another option would be to start another instance of Excel and minimize it.
Code:
    Dim xlTemp As Excel.Application
    Dim wbTemp As Workbook

    Set xlTemp = New Excel.Application

    xlTemp.Workbooks.Open "D:\Test.xls"

    xlTemp.WindowState = xlMinimized

    Set wdTemp = xlTemp.ActiveWorkbook

Hope this helps!
DimensionalSolutions@Core.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top