Help with Proceedures 101 - My simple Sub won't run ??

M

MyEmailList

I opened a form in design view
Clicked on View Code
Saw...
Option Compare Database

then added the code below...

Sub SayHello()
MsgBox "Hello"
End Sub

with my cursor in the proceedure I tried F5 to Run the sub...

But that opened a window window named "Macro" and asked for a Macro
Name... my sub wasn't visiable as an option

I tried F8 (Debug - Step Into) but same results

What am I doing wrong?

thanks for any help.

Mel
 
F

Franck

vba is not like vb, you need to trigger the code from and object. the
play button dont run code it ask to run macro. if you want to start it
with play you need to create a macro and point it to the sub.
 
M

MyEmailList

Well I'm having trouble creating the macro to run the proceedure.

I create a Macro to "Run Code" but then it only gives me the option of
running a "function"

maybe you could tell me a little more to get me going.

thanks
 
R

Rick Brandt

Well I'm having trouble creating the macro to run the proceedure.

I create a Macro to "Run Code" but then it only gives me the option of
running a "function"

maybe you could tell me a little more to get me going.

thanks

You have to change the sub to a function if you want to run it from a macro.
All that involves is literally changing the word "sub" to "function"
everywhere it occurs in the procedure.
 
M

MyEmailList

OK, I can do that.

BUT... it is true that when I create a sub or a function I can't use
the debug feature or the run feature from the code window? I must
launch & test the code from an object such as a macro or whatever ??

thanks for the help gang...
 
Top