Keep complaining "Must have startup form .." (newbie)

M

Maarten

Hi,

My very first VBA app, and stuck ;)

When I define a new project, it creates a blank form, and after running it shows the blank form, as
expected.

After that I add code like:

Sub Main()

MsgBox " My first test"

End Sub

and in the Project Property under StartUp Object I select "Sub Main" for the start up.

And it keeps complaining "Must have startup form of Sub Main()".

What might be wrong ?

Txs

Must have startup form .."
 
R

rVo

From what you are writing I guess you have some experience in Visual Basic
:)

You should write your main code in a module and make it show your form.
If you want to show your form right at the start, put the code to show your
form in a
"Sub autoNew" if your form is called myFirstForm you can use
myFirstForm.show to make it visible.

If you really need to show a msgbox from inside the form add a
Private Sub UserForm_Initialize()
msgbox "blablabla"
end sub
to your form's code.

hope this helps,

rVo
 

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