PDA

View Full Version : Solved: Multipage Focus on UserForm



Zack Barresse
08-24-2004, 04:37 PM
Hi,

I have a UserForm with a multipage on it (2 pages). I want to be able to always have the focus on Page 1 when the UserForm is loaded. I've got this so far ...

Private Sub UserForm_Initialize()
MultiPage1.SetFocus
End Sub

but it doesn't seem to work. Anybody know the correct syntax I should be using here? Thanks. :)

lucas
08-24-2004, 05:25 PM
Zack,

I hope I understand what your trying to do...I think you want page 1 to be on top every time you open your multipage form...

I tried this several times and it worked for me. In the VBE set the page you want to be on top....I think the way you leave it in the VBE is the way it will show when you call it.

jamescol
08-24-2004, 06:52 PM
Zack,
To ensure the first page is always the default, use the following code in the form's initialize event:



'Page 0 is the first page
MultiPage1.Value = 0


Cheers,
James

Jacob Hilderbrand
08-24-2004, 07:49 PM
I do the same as lucas. Whatever page is on top in the VBE is the one on top when the form loads. Otherwise set the value property to the page you want, like James said.

Zack Barresse
08-25-2004, 09:45 AM
Lucas/DRJ,

Yes that is the way it works. This is what I have been doing. But I do a lot of editing and troubleshooting on my add-ins and am constantly in and out of the VBE fixing little tweaks and bugs and whatnot. I can't count the times I've gone in and done some editing to page 2 of the multipage and just saved/closed. That's basically what spurred this question on. :)

James,

I'll try your solution out here in a little bit. Thanks for that. :yes

lucas
08-25-2004, 04:39 PM
James,

That is good to know, thanks.