That depends on what you want the program to do. You can run code without a
form on screen, and also can continue to run after the form is dismissed.
In a code module:
Public Sub test1()
UserForm1.Show
'now any code in the form's initialize event will run
'press button on form to dismiss form,
'code in button click event runs - make sure there's a Hide statement
for the form in this event
Unload UserForm1
'now you can run some code here, depending on user's input on form
End Sub
--
Kevin
"gvanaco" wrote in message
news:3685FC535499E4DB77DB17AB1EC6B9D9@in.WebX.maYIadrTaRb...
> and if the form disapere, my initial program stays running?
>
>
> thanks for the help
>
> "Kevin Terry" wrote in
> news:607D83D4FDE2C6C9EFAE30BF533D0201@in.WebX.maYIadrTaRb:
>
> > In your module, declare a global variable (example: sSheetName). In
> the
> > button click event, transfer the list box value to that variable:
> >
> > in module:
> > public sSheetName as string
> >
> > in form:
> > Private Sub CommandButton1_Click()
> > sSheetName = ListBox1.Value
> > Unload Me
> > 'now call some other routine, or run other code here
> > End Sub
> >
> > --
> > Kevin
> >
> >
> > "gvanaco" wrote in message
> > news:9B5C3EF2F361BAE85F7FB4143EAC83A2@in.WebX.maYIadrTaRb...
> >> The program is a connection to a excel tabel.
> >>
> >> I would selecting one sheet from the excel file.
> >>
> >> It works for displaying the sheetnames but I do not nowing how I
> should
> >> selecting.
> >>
> >>
> >>
> >>
> >>
> >> "John Goodfellow" wrote in
> >> news:A31531C764B4BE301AB7606C0E963809@in.WebX.maYIadrTaRb:
> >>
> >> > 1. Difficult to help you without seeing what you are doing.
> >> > How are you calling the form?
> >> > How are you leaving the form?
> >> > Show some code.
> >> >
> >> > 2. Add a PUBLIC variable in the module section (before any SUB's or
> >> > FUNCTION's) of the THISDRAWING code module (e.g. Public strSomeText
> As
> >> > String), then refer to it in the form code via the THISDRAWING
> object
> >> > (e.g. ThisDrawing.strSomeText).
> >> > --
> >> > John Goodfellow
> >> > irtfnm
> >> > use john at goodfellowassoc dot com
> >> >
> >> >
> >> > "gvanaco" wrote in message
> >> > news:5F6E8DC3EAB881994EAD6F370E7A27AD@in.WebX.maYIadrTaRb...
> >> >> I create an vba program that do some action calls a user form, I
> put
> >> >> data in it. And the program should finnishe.
> >> >>
> >> >> But my program stops after excecuting the form.
> >> >>
> >> >>
> >> >> Next question.
> >> >>
> >> >> How can I get variabels (DIM) to the form and back.
> >> >>
> >> >> Thanks a lot
> >> >
> >> >
> >>
> >
> >
> >
>