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!

Start Excel minimized? 1

Status
Not open for further replies.

tlogan

Programmer
Jun 26, 2001
33
US
Is there a way to start Excel minimized? I am trying to automoate a macro (which I can do) but I want the entire process to run unattended once it's started. I can get it to the point of being able to double-click on the filename of the spreadsheet and it will run the macro and automatically close itself, I just can't get it to run minimized. Basically I'm look to be able to run Excel in the background. So far, when the macro runs you see all of the windows flashing by, which is VERY annoying to the user). I've not been able to find anyway to get Excel to run minimized.

Anyone have any ideas? I am running Excel 2000.

Thanks!
TLogan
 
What have you so far ?
What about something like ?
YourExcelAppObj.Visible = False

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
I've tried that in the Autostart routine just prior to running the Macro AND in the Workbook.Activate routine and neither seem to work. Any other ideas where to put it (in a nice way, I mean :) )?
 
Application.Visible = False should work if used in a sub. When you say "Autostart" I'm assuming that is the name of your subroutine. Just include "Application.Visible = False" at some point early on in that sub. If not, you might need to be a little more specific on what's going on.

********************
What's the best way to get the answers you need?? See FAQ222-2244 for details!
 

Try

Application.ScreenUpdating = False
Application.WindowState = xlMinimized


But Application.Visible should also work, but there is a danger of leaving invisible Excel's running.
 
Thanks for the replies!

The name of the subroutine is WORKBOOK_OPEN(). This is the routine that runs when Excel is started. If you place the name of a macro in this routine, the macro will run when Excel is started (thus, autorun). I tried placing the "Application.Visible=False" just before the name of the macro. There are only two lines in the subroutine:

Code:
Private Sub Workbook_Open()
Application.Visible = False
MyMacroName
End Sub

Currently, we have 60( count 'em sixty!) spreadsheets that need to be modified every Monday morning. Basically, the macro opens two TXT files, manipulates the data and then saves the spreadsheet. Right now, we have to open each spreadsheet and manually run the macro. I want to be able to create a batch file to run all of the spreadsheets unattended from the command line.

So far, what happens when you double-click the XLS file (or run it from the command line) is that Excel starts, flashes an open window and then minimizes, runs the macro and exits (I added code to save changed files and exit at the end of the macro). It DOES run unattended, it just flashes that first window before minimizing, which is REALLY annoying. So, my question is, is there a way to eliminate that first screen from opening visible?

I hope that helps clarify what I'm trying to do.

Thanks,
TLogan
 
You may take a look at the /e command line argument of excel.
BTW, how are your 60 spreadsheets open ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Thanks PH, but /e doesn't work either.
And BTW, DrBowes suggestion doesn't solve the flashing open problem either. Thanks to you, too!

It still flashes open and then minimizes. Right now, the spreadsheets are opened manually, one at a time...double-click on XLS file, then run macro. I've modified the spreadsheet(s) so that when run from a BAT file, the spreadsheet opens and runs the macro automatically. It's just that for every spreadsheet, Excel opens and flashes before minimizing.

(PH - Quick note on the BAT file...the BAT is not the problem...using TLIST I can determine when Excel is running and only execute one spreadsheet at a time, so I'm NOT running all 60 at once!)

I'm guessing at this point that Excel just isn't designed to be run completely in the background.

Thanks again to all for your help!
TLogan
 
A bat file ?
Why not use the /MIN switch of the START command ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
...because I AM AN IDIOT.

That WORKS. Not only that, but by using the /WAIT switch I don't have to loop through PULIST to determine if an Excel process is running. This simplies the BAT file greatly. Thanks a gazillion, PH! You get my vote!

Actually, everything I know about BAT files I learned over the past two weeks. And that's more than I EVER wanted to know. I would have prefered to use Perl or something but given the tools at hand and the amount of time to complete this task, this was the fastest, easiest way to go. Also, the BATCH help site I was using had START listed as an OS2/NT command, so I didn't think I could use it. The Windows9X/2000 sysntax was buried.

Thanks again for all your help,
TLogan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top