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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vba excel workbook question 1

Status
Not open for further replies.

Jdoggers

Technical User
Feb 20, 2005
43
US
Hi,
I was wondering if there was any way for vba code to automatically minimize all the open workbooks when i press a button on a form. Example:

lets say that i have 2 open workbooks and i run my macro and part of that macro i want to minimize all open workbooks at the time. The only thing is that i dont know how many workbooks it is, and it could be none also. So basically i want to check if there is open workbooks other then the one im opening, and if so close all the other workbooks, along with maximize the one that im just opening with my macro. Any ideas?

thanks guys
 
Try something like the following:

Code:
Sub MinimizeWorkbooks()
Dim Wnd As Window

   For Each Wnd In Application.Windows
     Wnd.WindowState = xlMinimized
   Next Wnd
   
End Sub

To restore, set WindowState = xlMaximized


Regards,
Mike
 
Does the Operating System affect VBA code?

I have some vba code in an excel spreadsheet macro that selects various items on a chart and then sets the font size, position, etc. I've tested this spreadsheet using U.S. English Excel 11.x (Office 2003), Excel 10.x (Office XP), and Excel 9.x (Office 2000). One gentleman in France is now telling me that the spreadsheet code fails on his U.S. English Excel 9.x which is installed on a French Windows XP. He also has the same version of Office installed on a German Windows XP which also fails. I've ensured that his Office suite is up-to-date with the most recent patches.

Has anyone heard of the Operating System affecting the functionality of vba within a spreadsheet?

Thanks!
Nyle
 
Nyle,
Please post your question in a new thread.

Among other things, date formats and list separators are controlled by Windows rather than Excel--and they will be different in France than in US. If your code writes a formula to the spreadsheet, then you'll need to change the comma to a semicolon in some countries. And if your code uses dates, the worksheet may store them in d/m/yyyy format rather than the US-style m/d/yyyy.
Brad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top