ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Multipage default open (https://www.excelbanter.com/excel-programming/420504-multipage-default-open.html)

Whois Clinton

Multipage default open
 
Hi,

I am trying to set a default opening page for the multipage on a userform.
When I use:

Private Sub MultiPage1_Change()
UserForm1.MultiPage1.Value = 0
End Sub

OR

Private Sub MultiPage1_Change()
MultiPage1.Value = 0
End Sub

The dafult still does not work and it causes the labelling tabs to not work
correctly. I have to click it twice, 1st changes the tab appearnce 2nd
changes the actual page.
I would simply like it to always open on the first page.

Thanks in advance,
Matt

royUK[_57_]

Multipage default open
 

Your code is basically correct, but it should be in the initialise event
of the userform

Code:
--------------------

Private Sub UserForm_Initialize()
'note page numbers start from 0
Me.MultiPage1.Value = 1
End Sub
--------------------


--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site
' (http://www.excel-it.com)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=33777


Chip Pearson

Multipage default open
 
I don't think you want to be using the Change event. You can specify
the default opening page in the designer's Properties window for the
MultiPage by changing the Value property Or, you can do it with code
when the form is loaded.

Private Sub UserForm_Initialize()
With Me.MultiPage1
.Value = 1 ' 0-based. Page1=0, Page2=1, etc
End With
End Sub

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Tue, 25 Nov 2008 06:36:16 -0800, Whois Clinton
wrote:

Hi,

I am trying to set a default opening page for the multipage on a userform.
When I use:

Private Sub MultiPage1_Change()
UserForm1.MultiPage1.Value = 0
End Sub

OR

Private Sub MultiPage1_Change()
MultiPage1.Value = 0
End Sub

The dafult still does not work and it causes the labelling tabs to not work
correctly. I have to click it twice, 1st changes the tab appearnce 2nd
changes the actual page.
I would simply like it to always open on the first page.

Thanks in advance,
Matt


Whois Clinton

Multipage default open
 
I tried that but came up with the same problem. Here is the complete codes
assocaited with opening the userform. I also have this linked to a command
button to start it, if that matters. I have tried inserting the line
regarding multipage value=0 in the first Sub section. That hasn't helped
either. This is my first userform so I assume it is a beginner mistake.

Thanks for your time,
Clint


Option Explicit
Sub OpenUserfrm1()
UserForm1.Show
End Sub

Private Sub UserForm_Initialize()
'note page numbers start from 0
Me.MultiPage1.Value = 0
End Sub





"royUK" wrote:


Your code is basically correct, but it should be in the initialise event
of the userform

Code:
--------------------

Private Sub UserForm_Initialize()
'note page numbers start from 0
Me.MultiPage1.Value = 1
End Sub
--------------------


--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site
' (http://www.excel-it.com)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=33777



royUK[_59_]

Multipage default open
 

Have you put the code in the userform module?


--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site
' (http://www.excel-it.com)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=33777


Whois Clinton

Multipage default open
 
I tried adding the code in with the initializing code.
ORIGINAL OPENING CODE

Option Explicit
Sub OpenUserfrm1()
UserForm1.Show
End Sub

Tried to add as follows:
Option Explicit
Sub OpenUserfrm1()
UserForm1.Show
End Sub
Private Sub UserForm_Initialize()
With Me.MultiPage1.Value = 1 ' 0-based. Page1=0, Page2=1, etc
End With
End Sub

That is not working either. Nor is adding the code in the set below which
controls the tools on the form. What am I missing?


Option Explicit

Private Sub CommandButton2_Click()
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
comboxResidentialList.Value = "Choose from below"

UserForm1.Hide
End Sub

Private Sub Commandbutton1_click()

Range("A1").Value = TextBox1.Value
Range("B1").Value = TextBox2.Value
Range("C1").Value = TextBox3.Value
Range("D1").Value = comboxResidentialList.Value
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
comboxResidentialList.Value = "Choose from below"
UserForm1.Hide

End Sub
Private Sub ListBox1_Click()

End Sub
Private Sub MultiPage1_Change()

End Sub

Private Sub UserForm_Click()

End Sub





"Chip Pearson" wrote:

I don't think you want to be using the Change event. You can specify
the default opening page in the designer's Properties window for the
MultiPage by changing the Value property Or, you can do it with code
when the form is loaded.

Private Sub UserForm_Initialize()
With Me.MultiPage1
.Value = 1 ' 0-based. Page1=0, Page2=1, etc
End With
End Sub

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Tue, 25 Nov 2008 06:36:16 -0800, Whois Clinton
wrote:

Hi,

I am trying to set a default opening page for the multipage on a userform.
When I use:

Private Sub MultiPage1_Change()
UserForm1.MultiPage1.Value = 0
End Sub

OR

Private Sub MultiPage1_Change()
MultiPage1.Value = 0
End Sub

The dafult still does not work and it causes the labelling tabs to not work
correctly. I have to click it twice, 1st changes the tab appearnce 2nd
changes the actual page.
I would simply like it to always open on the first page.

Thanks in advance,
Matt



royUK[_62_]

Multipage default open
 

This code should be in the actual userform.

In the VB Editor Properties you can see the form. Double click on it to
access the form as if you were adding controls.

Next double click on the actual form to access it's events. In the left
hand drop down find Initialize. That's where you need to paste the code


Code:
--------------------
Private Sub UserForm_Initialize()
With Me.MultiPage1.Value = 1 ' 0-based. Page1=0, Page2=1, etc
End With
End Sub
--------------------


--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site
' (http://www.excel-it.com)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=33777


Whois Clinton

Multipage default open
 
THanks Roy that got me to the right spot but now returns:

Compile error:
With object must be user-defined type, Object, or Variant


"royUK" wrote:


This code should be in the actual userform.

In the VB Editor Properties you can see the form. Double click on it to
access the form as if you were adding controls.

Next double click on the actual form to access it's events. In the left
hand drop down find Initialize. That's where you need to paste the code


Code:
--------------------
Private Sub UserForm_Initialize()
With Me.MultiPage1.Value = 1 ' 0-based. Page1=0, Page2=1, etc
End With
End Sub
--------------------


--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site
' (http://www.excel-it.com)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=33777



royUK[_63_]

Multipage default open
 

Lost a carriage return somewhere, should be



Code:
--------------------
Private Sub UserForm_Initialize()
With Me
.MultiPage1.Value = 1 ' 0-based. Page1=0, Page2=1, etc
End With
End Sub
--------------------


or

Code:
--------------------

Private Sub UserForm_Initialize()
'note page numbers start from 0, so this will open page 2
Me.MultiPage1.Value = 1
End Sub
--------------------


--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site
' (http://www.excel-it.com)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=33777


Whois Clinton

Multipage default open
 
No errors now but the user form still opens to whichever page was last
active. Just to be sure I am doing this right here is the exact code for the
user form:

Option Explicit

Private Sub CommandButton2_Click()
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
comboxResidentialList.Value = "Choose from below"
UserForm1.Hide
End Sub

Private Sub Commandbutton1_click()

Range("A1").Value = TextBox1.Value
Range("B1").Value = TextBox2.Value
Range("C1").Value = TextBox3.Value
Range("D1").Value = comboxResidentialList.Value
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
comboxResidentialList.Value = "Choose from below"
UserForm1.Hide

End Sub
Private Sub ListBox1_Click()

End Sub

Private Sub Label1_Click()

End Sub

Private Sub MultiPage1_Change()

End Sub

Private Sub UserForm_Click()

End Sub

Private Sub UserForm_Initialize()
With Me
.MultiPage1.Value = 0 ' 0-based. Page1=0, Page2=1, etc
End With

End Sub

Both codes put into initailze sub have no effect. Sorry it isn't working yet.
thanks even more!!
Clint


"royUK" wrote:


Lost a carriage return somewhere, should be



Code:
--------------------
Private Sub UserForm_Initialize()
With Me
.MultiPage1.Value = 1 ' 0-based. Page1=0, Page2=1, etc
End With
End Sub
--------------------


or

Code:
--------------------

Private Sub UserForm_Initialize()
'note page numbers start from 0, so this will open page 2
Me.MultiPage1.Value = 1
End Sub
--------------------


--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site
' (http://www.excel-it.com)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=33777



Chip Pearson

Multipage default open
 
The form's Initialize event runs only when the form is loaded into
memory. If you close out the form using

UserForm1.Hide

the form is still loaded into memory and when shown again is only made
visible, not loaded, so the Initialize event won't run. You can dump
the form out of memory using

Unload UserForm1

This dumps the form, so the next time you Show it, it is reloaded and
the Initialize event will execute.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Tue, 25 Nov 2008 10:13:07 -0800, Whois Clinton
wrote:

No errors now but the user form still opens to whichever page was last
active. Just to be sure I am doing this right here is the exact code for the
user form:

Option Explicit

Private Sub CommandButton2_Click()
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
comboxResidentialList.Value = "Choose from below"
UserForm1.Hide
End Sub

Private Sub Commandbutton1_click()

Range("A1").Value = TextBox1.Value
Range("B1").Value = TextBox2.Value
Range("C1").Value = TextBox3.Value
Range("D1").Value = comboxResidentialList.Value
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
comboxResidentialList.Value = "Choose from below"
UserForm1.Hide

End Sub
Private Sub ListBox1_Click()

End Sub

Private Sub Label1_Click()

End Sub

Private Sub MultiPage1_Change()

End Sub

Private Sub UserForm_Click()

End Sub

Private Sub UserForm_Initialize()
With Me
.MultiPage1.Value = 0 ' 0-based. Page1=0, Page2=1, etc
End With

End Sub

Both codes put into initailze sub have no effect. Sorry it isn't working yet.
thanks even more!!
Clint


"royUK" wrote:


Lost a carriage return somewhere, should be



Code:
--------------------
Private Sub UserForm_Initialize()
With Me
.MultiPage1.Value = 1 ' 0-based. Page1=0, Page2=1, etc
End With
End Sub
--------------------


or

Code:
--------------------

Private Sub UserForm_Initialize()
'note page numbers start from 0, so this will open page 2
Me.MultiPage1.Value = 1
End Sub
--------------------


--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site
' (http://www.excel-it.com)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=33777



Whois Clinton

Multipage default open
 
Thanks again Chip, I have used your site quite often. Greatly appreciate the
explanation too, it will save me questions in the future.
Clint

"Chip Pearson" wrote:

The form's Initialize event runs only when the form is loaded into
memory. If you close out the form using

UserForm1.Hide

the form is still loaded into memory and when shown again is only made
visible, not loaded, so the Initialize event won't run. You can dump
the form out of memory using

Unload UserForm1

This dumps the form, so the next time you Show it, it is reloaded and
the Initialize event will execute.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Tue, 25 Nov 2008 10:13:07 -0800, Whois Clinton
wrote:

No errors now but the user form still opens to whichever page was last
active. Just to be sure I am doing this right here is the exact code for the
user form:

Option Explicit

Private Sub CommandButton2_Click()
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
comboxResidentialList.Value = "Choose from below"
UserForm1.Hide
End Sub

Private Sub Commandbutton1_click()

Range("A1").Value = TextBox1.Value
Range("B1").Value = TextBox2.Value
Range("C1").Value = TextBox3.Value
Range("D1").Value = comboxResidentialList.Value
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
comboxResidentialList.Value = "Choose from below"
UserForm1.Hide

End Sub
Private Sub ListBox1_Click()

End Sub

Private Sub Label1_Click()

End Sub

Private Sub MultiPage1_Change()

End Sub

Private Sub UserForm_Click()

End Sub

Private Sub UserForm_Initialize()
With Me
.MultiPage1.Value = 0 ' 0-based. Page1=0, Page2=1, etc
End With

End Sub

Both codes put into initailze sub have no effect. Sorry it isn't working yet.
thanks even more!!
Clint


"royUK" wrote:


Lost a carriage return somewhere, should be



Code:
--------------------
Private Sub UserForm_Initialize()
With Me
.MultiPage1.Value = 1 ' 0-based. Page1=0, Page2=1, etc
End With
End Sub
--------------------


or

Code:
--------------------

Private Sub UserForm_Initialize()
'note page numbers start from 0, so this will open page 2
Me.MultiPage1.Value = 1
End Sub
--------------------


--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site
' (http://www.excel-it.com)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=33777




royUK[_78_]

Multipage default open
 

Have uo renamed the MultiPage, if so you should use that name in the
code.


--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site' (http://www.excel-it.com/)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=33777



All times are GMT +1. The time now is 03:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com