Auto_Open() macro in excel97

I am trying to create a macro to run whenever a particular workbook is opened. I have done some searches and it appears that I just create a macro called Auto_Open(). To test this I used the code Sub Auto_Open() MsgBox (test) End Sub This did not work.

Windows Software 5498 This topic was started by ,


data/avatar/default/avatar30.webp

556 Posts
Location -
Joined 2003-03-28
I am trying to create a macro to run whenever a particular workbook is opened. I have done some searches and it appears that I just create a macro called Auto_Open().
 
To test this I used the code
 
Sub Auto_Open()
MsgBox ("test")
End Sub
 
This did not work. Can anyone tell me how to do this? Visual basic continues to baffle me.

Participate on our website and join the conversation

You have already an account on our website? Use the link below to login.
Login
Create a new user account. Registration is free and takes only a few seconds.
Register
This topic is archived. New comments cannot be posted and votes cannot be cast.

Responses to this topic


data/avatar/default/avatar30.webp

556 Posts
Location -
Joined 2003-03-28
OP
Quote:Quote:I am trying to create a macro to run whenever a particular workbook is opened. I have done some searches and it appears that I just create a macro called Auto_Open().

To test this I used the code

Sub Auto_Open()
MsgBox ("test")
End Sub

This did not work. Can anyone tell me how to do this? Visual basic continues to baffle me.

All or most Microsoft "compound" OLE document types have an autoexec.macro... that's the one to look @!

(That's also the one that macro virii infect as well)

*

APK

P.S.=> & like autoexec.bat & your startup groups etc., you can bypass opening & running it by holding down the shift key as it opens... some extra "FYI"... apk

I don't know if I am understanding you or not.

Are you saying to use
Sub AutoExec()
MsgBox ("test")
End Sub

or

Sub AutoExec.macro()
MsgBox ("test")
End Sub

?

Neither of these seem to work. The AutoExec.macro doesn't like the '.'

Thanks

data/avatar/default/avatar30.webp

556 Posts
Location -
Joined 2003-03-28
OP
Nevermind... I finally got auto_open() to work. Not sure why though.