Hi, sorry if this is an obvious question but I can't work it out.
I've created a userform that wants displaying on a worksheet as
default, how do I make it display?
I don't want it to appear when the user presses a button or anything,
it just needs to be on the sheet all the time.
Thanks.
Brotherwarren - 25 Sep 2007 08:52 GMT
I think it might work if you enter the userform.show(false) command in
the workbook, open module.
In VBA go to the project explorer and double click on the 'this
workbook', when the module opens, click on the drop boxes at the top
and change them to read workbook an open, repectively.
Enter the text NAMEOFMYUSERFORM.show(false) in this place.
Everytime the workbook opens, this code runs,
the (false) bit means that you can click on other things, such as
cells or other features without closing your form first.
David - 25 Sep 2007 09:06 GMT
Thanks, I'm now getting an error when I load the workbook:
"Compile Error:
Wrong number of arguments or invalid property assignment."
The line "Private Sub Workbook_Open()" is highlighted when I click OK,
this line was automatically added by Excel when I entered the line you
asked me to try.
Here's the code:
Private Sub Workbook_Open()
UserForm1.Show (False)
End Sub
The above code is displayed with the dropdowns showing as Workbook and
Open, there's no "Read Workbook" or "Open Macro" options, I'm using
Excel 97 if that makes a difference.
Thanks again!
Bob Phillips - 25 Sep 2007 09:07 GMT
Private Sub Workbook_Open()
Userform1.Show
End Sub
'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code

Signature
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
> Hi, sorry if this is an obvious question but I can't work it out.
>
[quoted text clipped - 5 lines]
>
> Thanks.
David - 25 Sep 2007 09:13 GMT
Thanks both of you it's now working!