#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default Form Show


The Brackets in the Show Command e.g.

frmMyForm.Show ()

... what are they used for?

I thought it was for passing a variable, but if I put
one in the brackets, how can I read it ?

I've tried

Private Sub UserForm_Activate(x)
End Sub

Private Sub UserForm_Initialize(x)
End Sub

Bring up an error 'Procedure declaration does not match description of
event or procedure having the same name'

I can't find a 'Form Load' or any place in properties to use.

What am I doing wrong?


Thanks - Kirk

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Form Show

I tried:
Userform1.show()
and it didn't even compile.

One easy way to pass variables to a userform is to use public variables.
Declare them in a General module outside any procedu

Public myVar as Variant
Public myLong as long
....

Then your can assign what you want to that public variable and pick it up in
your userform code.

Another way is to load the form (not show it), then do the assignments, then
show the userform:

Load UserForm1
UserForm1.CheckBox1.Value = True
UserForm1.Show



kirkm wrote:

The Brackets in the Show Command e.g.

frmMyForm.Show ()

.. what are they used for?

I thought it was for passing a variable, but if I put
one in the brackets, how can I read it ?

I've tried

Private Sub UserForm_Activate(x)
End Sub

Private Sub UserForm_Initialize(x)
End Sub

Bring up an error 'Procedure declaration does not match description of
event or procedure having the same name'

I can't find a 'Form Load' or any place in properties to use.

What am I doing wrong?

Thanks - Kirk


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Form Show

Dave,

If we want to pull a value back out of the user form, is the only way to do
that with a Public variable?

Thanks,
Barb

"Dave Peterson" wrote:

I tried:
Userform1.show()
and it didn't even compile.

One easy way to pass variables to a userform is to use public variables.
Declare them in a General module outside any procedu

Public myVar as Variant
Public myLong as long
....

Then your can assign what you want to that public variable and pick it up in
your userform code.

Another way is to load the form (not show it), then do the assignments, then
show the userform:

Load UserForm1
UserForm1.CheckBox1.Value = True
UserForm1.Show



kirkm wrote:

The Brackets in the Show Command e.g.

frmMyForm.Show ()

.. what are they used for?

I thought it was for passing a variable, but if I put
one in the brackets, how can I read it ?

I've tried

Private Sub UserForm_Activate(x)
End Sub

Private Sub UserForm_Initialize(x)
End Sub

Bring up an error 'Procedure declaration does not match description of
event or procedure having the same name'

I can't find a 'Form Load' or any place in properties to use.

What am I doing wrong?

Thanks - Kirk


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Form Show

If the form is still loaded (but hidden???), you can get the value this way:

I put this behind the Ok button on a userform:

Option Explicit
Private Sub CommandButton1_Click()
Me.Hide
End Sub


And I used this to load the form:

Option Explicit
Sub testme()
Dim myStr As String

UserForm1.Show
myStr = UserForm1.TextBox1.Value
Unload UserForm1

MsgBox myStr

End Sub


Barb Reinhardt wrote:

Dave,

If we want to pull a value back out of the user form, is the only way to do
that with a Public variable?

Thanks,
Barb

"Dave Peterson" wrote:

I tried:
Userform1.show()
and it didn't even compile.

One easy way to pass variables to a userform is to use public variables.
Declare them in a General module outside any procedu

Public myVar as Variant
Public myLong as long
....

Then your can assign what you want to that public variable and pick it up in
your userform code.

Another way is to load the form (not show it), then do the assignments, then
show the userform:

Load UserForm1
UserForm1.CheckBox1.Value = True
UserForm1.Show



kirkm wrote:

The Brackets in the Show Command e.g.

frmMyForm.Show ()

.. what are they used for?

I thought it was for passing a variable, but if I put
one in the brackets, how can I read it ?

I've tried

Private Sub UserForm_Activate(x)
End Sub

Private Sub UserForm_Initialize(x)
End Sub

Bring up an error 'Procedure declaration does not match description of
event or procedure having the same name'

I can't find a 'Form Load' or any place in properties to use.

What am I doing wrong?

Thanks - Kirk


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Form Show

If you use the Public variables in Private functions, you have remove the
Private from the function names. for example, if you use a public variable
in a click function.

"Dave Peterson" wrote:

I tried:
Userform1.show()
and it didn't even compile.

One easy way to pass variables to a userform is to use public variables.
Declare them in a General module outside any procedu

Public myVar as Variant
Public myLong as long
....

Then your can assign what you want to that public variable and pick it up in
your userform code.

Another way is to load the form (not show it), then do the assignments, then
show the userform:

Load UserForm1
UserForm1.CheckBox1.Value = True
UserForm1.Show



kirkm wrote:

The Brackets in the Show Command e.g.

frmMyForm.Show ()

.. what are they used for?

I thought it was for passing a variable, but if I put
one in the brackets, how can I read it ?

I've tried

Private Sub UserForm_Activate(x)
End Sub

Private Sub UserForm_Initialize(x)
End Sub

Bring up an error 'Procedure declaration does not match description of
event or procedure having the same name'

I can't find a 'Form Load' or any place in properties to use.

What am I doing wrong?

Thanks - Kirk


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Form Show

I could be wrong, and frequently am, but from what I can see in the Show
Method decription, only DialogBoxes offer the argument () option. It does
not apply to the UserForm.Show method.

"kirkm" wrote:


The Brackets in the Show Command e.g.

frmMyForm.Show ()

... what are they used for?

I thought it was for passing a variable, but if I put
one in the brackets, how can I read it ?

I've tried

Private Sub UserForm_Activate(x)
End Sub

Private Sub UserForm_Initialize(x)
End Sub

Bring up an error 'Procedure declaration does not match description of
event or procedure having the same name'

I can't find a 'Form Load' or any place in properties to use.

What am I doing wrong?


Thanks - Kirk


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to show time on a form NDBC Excel Discussion (Misc queries) 2 June 30th 09 11:22 AM
How to show User Form when form name is in string? Don Wiss Excel Programming 2 December 9th 06 03:52 AM
How do I do? A personalized form, similar to Show data Form Isaac[_2_] Excel Programming 0 July 5th 06 08:14 PM
Form.Show problem Glen Mettler[_4_] Excel Programming 2 August 9th 05 01:51 PM
Help! Animated gif-image in form does not show animation when form loaded JoCa Excel Programming 4 September 23rd 04 07:43 PM


All times are GMT +1. The time now is 04:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"