View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Hide the spreadsheet

in the VBE, double click on the Thisworkbook entry in the project explorer
(on the left ) entry for your project. This will bring up the ThisWorkbook
code module. in the left dropdown at the top of the module select Workbook,
in the right dropdown at the top of the module select Open. This will put
in the declaration for the Workbook_Open event which fires when the workbook
is opened.

Private Sub Workbook_Open()

End sub

You can add code here or call your macro

Private Sub Workbook_Open()
MyMacro
End sub

See Chip Pearson's page on events for a general overview
http://www.cpearson.com/excel/events.htm

--
Regards,
Tom Ogilvy


"David" wrote in message
oups.com...
Thanks Tom that worked great. Also is there any way to run a macro when
excel first starts instead of having to have the user click run.
Thanks.

- David
Tom Ogilvy wrote:
No on the correction, i is adjusted by the FOR loop
adding to j was some dummy work - yes, it is just to cause a delay. It
was
for demonstration purposes only.

--
Regards,
Tom Ogilvy

"Mike Fogleman" wrote in message
m...
Tom, that would be
i = i + 1

This creates a kind of 'Wait' command adjusting the length of time
with
the number.

Mike F
"Tom Ogilvy" wrote in message
...
Application.Visible = False

or

Sub ABC()
Application.WindowState = xlMinimized
For i = 1 To 10000000
j = j + 1
Next
Application.WindowState = xlNormal
End Sub


if you are doing a lot of selecting just try using
Application.ScreenUpdating = False

Sub MyExistingSub()
Application.Screenupdating = False

' current commands

Application.Screenupdating = True
End Sub

--
Regards,
Tom Ogilvy


"David" wrote in message
ps.com...
I was wondering if it would be possible to hide the normal excel
window
while a macro was running. Thanks

- David