Launch Macro at startup

H

HotRod

This goes with my question below but. I want to launch a "loop" macro when
the excel sheet is opened to monitor the time and then run another macro
when it's 8:00 am. In VB I'd use the Form_Laod but what do I use in VBA?
Also is there a better way to monitor the time than in a WHILE <> Loop?
 
Z

Zigball

Not sure if this is what you are looking for:

Public Sub LoopMacro()

LoopMacro.Show vbModal

End Sub
 
Z

Zigball

Disregard the first message you want to put this in the workbook

Private Sub Workbook_Open()

LoopMacro.Show vbModal

End Sub

Create a module for the Loopmacro.
 
H

HotRod

Private Sub Workbook_Open()

Doesn't seem to work. Even after closing and opening the workbook the cde is
not executed. Am I missing something?
 
D

Dave Peterson

Make sure you put that procedure under ThisWorkbook--not behind a worksheet, not
in a General module.

And make sure you allow macros to run when you open that file (check your
security settings).
 
Z

Zigball

Im usually on the question end of this forum so I would probably re
submit my question if i were you. If I am not mistaken you are trying
to get a macro to start at start up if this is correct please disregard
all my solutions because those are simply for starting up user forms at
start up. Good luck and I am sure you will get the correct answer
because this is probably one of the best places to get a right answer
for any questions or problems one might have, sorry!
 
H

HotRod

I managed to get it working once I moved the code into the Workbook into the
sheet. Stupid rookie mistake..
 

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