Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Initializing UserForm which uses MultiPage controls
I am having a problem Initializing my UserForm which has on it 2 MultiPage
controls. Before I added the second MultiPage control (which is located on Page2 of MultiPage1) everything worked fine. Now when I try to open the UserForm I get Object not found errors. I assume I must some how account for the second MultiPage control in the "With" statement, but nothing I have tried works. With Me.MultiPage1 .Value = .Pages(myMPPageName).Index End With Private Sub UserForm_Initialize() 'This macro intializes the Data Input UserForm With Me.MultiPage1 .Value = .Pages(myMPPageName).Index End With 'Populates the End of Period Data on MultiPage1 TextBox1.Text = Worksheets("Audit Report Page 1").Range("E4").Text TextBox2.Text = Worksheets("Audit Report Page 1").Range("E7").Text TextBox3.Text = Worksheets("Audit Report Page 1").Range("E8").Text 'Populates Outstanding Checks on MultiPage1 TextBox8.Text = Worksheets("Outstanding Checks").Range("A5").Text TextBox9.Text = Worksheets("Outstanding Checks").Range("B5").Text TextBox10.Text = Worksheets("Outstanding Checks").Range("C5").Text 'Populates January Income on MultiPage2 TextBox80.Text = Worksheets("Income").Range("B3").Text TextBox81.Text = Worksheets("Income").Range("C3").Text TextBox82.Text = Worksheets("Income").Range("D3").Text |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Initializing UserForm which uses MultiPage controls
I didn't need to in my little test.
Are you sure your myMPPageName is holding the correct value? And if you're trying to get to the second page within that "sub-page", this worked ok for me: In a general module: Option Explicit Public myMPPage1Name As String Public myMPPage2Name As String Sub testme() myMPPage1Name = "Page2" myMPPage2Name = "Page4" UserForm1.Show End Sub Behind the userform: Option Explicit Private Sub UserForm_Initialize() With Me.MultiPage1 .Value = .Pages(myMPPage1Name).Index End With With Me.MultiPage2 .Value = .Pages(myMPPage2Name).Index End With End Sub In my testing, I added a multipage control with page1 and page2. Then I added another multipage control to page2 with page3 and page4. The initialization code showed page2, and page4 on that page. Patrick Simonds wrote: I am having a problem Initializing my UserForm which has on it 2 MultiPage controls. Before I added the second MultiPage control (which is located on Page2 of MultiPage1) everything worked fine. Now when I try to open the UserForm I get Object not found errors. I assume I must some how account for the second MultiPage control in the "With" statement, but nothing I have tried works. With Me.MultiPage1 .Value = .Pages(myMPPageName).Index End With Private Sub UserForm_Initialize() 'This macro intializes the Data Input UserForm With Me.MultiPage1 .Value = .Pages(myMPPageName).Index End With 'Populates the End of Period Data on MultiPage1 TextBox1.Text = Worksheets("Audit Report Page 1").Range("E4").Text TextBox2.Text = Worksheets("Audit Report Page 1").Range("E7").Text TextBox3.Text = Worksheets("Audit Report Page 1").Range("E8").Text 'Populates Outstanding Checks on MultiPage1 TextBox8.Text = Worksheets("Outstanding Checks").Range("A5").Text TextBox9.Text = Worksheets("Outstanding Checks").Range("B5").Text TextBox10.Text = Worksheets("Outstanding Checks").Range("C5").Text 'Populates January Income on MultiPage2 TextBox80.Text = Worksheets("Income").Range("B3").Text TextBox81.Text = Worksheets("Income").Range("C3").Text TextBox82.Text = Worksheets("Income").Range("D3").Text -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Initializing UserForm which uses MultiPage controls
In a general module I had this code:
Public myMPPageName As String Sub showForm() myMPPageName = "Income" UserForm1.Show End Sub when I ran it (I created a userform similar to what you have), it worked fine. Each page has a (name) and a Caption property. I changed both for my pages. -- Regards, Tom Ogilvy "Patrick Simonds" wrote: I am having a problem Initializing my UserForm which has on it 2 MultiPage controls. Before I added the second MultiPage control (which is located on Page2 of MultiPage1) everything worked fine. Now when I try to open the UserForm I get Object not found errors. I assume I must some how account for the second MultiPage control in the "With" statement, but nothing I have tried works. With Me.MultiPage1 .Value = .Pages(myMPPageName).Index End With Private Sub UserForm_Initialize() 'This macro intializes the Data Input UserForm With Me.MultiPage1 .Value = .Pages(myMPPageName).Index End With 'Populates the End of Period Data on MultiPage1 TextBox1.Text = Worksheets("Audit Report Page 1").Range("E4").Text TextBox2.Text = Worksheets("Audit Report Page 1").Range("E7").Text TextBox3.Text = Worksheets("Audit Report Page 1").Range("E8").Text 'Populates Outstanding Checks on MultiPage1 TextBox8.Text = Worksheets("Outstanding Checks").Range("A5").Text TextBox9.Text = Worksheets("Outstanding Checks").Range("B5").Text TextBox10.Text = Worksheets("Outstanding Checks").Range("C5").Text 'Populates January Income on MultiPage2 TextBox80.Text = Worksheets("Income").Range("B3").Text TextBox81.Text = Worksheets("Income").Range("C3").Text TextBox82.Text = Worksheets("Income").Range("D3").Text |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Initializing UserForm which uses MultiPage controls
Note that if you excluded the parts about multipage2, it should still work.
If you want to make a page active on multipage2, it doesn't make any difference whether the page on multipage1 is the activepage or not. So related to your specific question in this post, mentioning mutipage2 is superflous. If you do want to set it, then Dave has shown you additional code that can be used. -- Regards, Tom Ogilvy "Dave Peterson" wrote: I didn't need to in my little test. Are you sure your myMPPageName is holding the correct value? And if you're trying to get to the second page within that "sub-page", this worked ok for me: In a general module: Option Explicit Public myMPPage1Name As String Public myMPPage2Name As String Sub testme() myMPPage1Name = "Page2" myMPPage2Name = "Page4" UserForm1.Show End Sub Behind the userform: Option Explicit Private Sub UserForm_Initialize() With Me.MultiPage1 .Value = .Pages(myMPPage1Name).Index End With With Me.MultiPage2 .Value = .Pages(myMPPage2Name).Index End With End Sub In my testing, I added a multipage control with page1 and page2. Then I added another multipage control to page2 with page3 and page4. The initialization code showed page2, and page4 on that page. Patrick Simonds wrote: I am having a problem Initializing my UserForm which has on it 2 MultiPage controls. Before I added the second MultiPage control (which is located on Page2 of MultiPage1) everything worked fine. Now when I try to open the UserForm I get Object not found errors. I assume I must some how account for the second MultiPage control in the "With" statement, but nothing I have tried works. With Me.MultiPage1 .Value = .Pages(myMPPageName).Index End With Private Sub UserForm_Initialize() 'This macro intializes the Data Input UserForm With Me.MultiPage1 .Value = .Pages(myMPPageName).Index End With 'Populates the End of Period Data on MultiPage1 TextBox1.Text = Worksheets("Audit Report Page 1").Range("E4").Text TextBox2.Text = Worksheets("Audit Report Page 1").Range("E7").Text TextBox3.Text = Worksheets("Audit Report Page 1").Range("E8").Text 'Populates Outstanding Checks on MultiPage1 TextBox8.Text = Worksheets("Outstanding Checks").Range("A5").Text TextBox9.Text = Worksheets("Outstanding Checks").Range("B5").Text TextBox10.Text = Worksheets("Outstanding Checks").Range("C5").Text 'Populates January Income on MultiPage2 TextBox80.Text = Worksheets("Income").Range("B3").Text TextBox81.Text = Worksheets("Income").Range("C3").Text TextBox82.Text = Worksheets("Income").Range("D3").Text -- Dave Peterson |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Initializing UserForm which uses MultiPage controls
But if I wanted to see that page4 on multipage2, I did have to make that
"parent" page active. Tom Ogilvy wrote: Note that if you excluded the parts about multipage2, it should still work. If you want to make a page active on multipage2, it doesn't make any difference whether the page on multipage1 is the activepage or not. So related to your specific question in this post, mentioning mutipage2 is superflous. If you do want to set it, then Dave has shown you additional code that can be used. -- Regards, Tom Ogilvy "Dave Peterson" wrote: I didn't need to in my little test. Are you sure your myMPPageName is holding the correct value? And if you're trying to get to the second page within that "sub-page", this worked ok for me: In a general module: Option Explicit Public myMPPage1Name As String Public myMPPage2Name As String Sub testme() myMPPage1Name = "Page2" myMPPage2Name = "Page4" UserForm1.Show End Sub Behind the userform: Option Explicit Private Sub UserForm_Initialize() With Me.MultiPage1 .Value = .Pages(myMPPage1Name).Index End With With Me.MultiPage2 .Value = .Pages(myMPPage2Name).Index End With End Sub In my testing, I added a multipage control with page1 and page2. Then I added another multipage control to page2 with page3 and page4. The initialization code showed page2, and page4 on that page. Patrick Simonds wrote: I am having a problem Initializing my UserForm which has on it 2 MultiPage controls. Before I added the second MultiPage control (which is located on Page2 of MultiPage1) everything worked fine. Now when I try to open the UserForm I get Object not found errors. I assume I must some how account for the second MultiPage control in the "With" statement, but nothing I have tried works. With Me.MultiPage1 .Value = .Pages(myMPPageName).Index End With Private Sub UserForm_Initialize() 'This macro intializes the Data Input UserForm With Me.MultiPage1 .Value = .Pages(myMPPageName).Index End With 'Populates the End of Period Data on MultiPage1 TextBox1.Text = Worksheets("Audit Report Page 1").Range("E4").Text TextBox2.Text = Worksheets("Audit Report Page 1").Range("E7").Text TextBox3.Text = Worksheets("Audit Report Page 1").Range("E8").Text 'Populates Outstanding Checks on MultiPage1 TextBox8.Text = Worksheets("Outstanding Checks").Range("A5").Text TextBox9.Text = Worksheets("Outstanding Checks").Range("B5").Text TextBox10.Text = Worksheets("Outstanding Checks").Range("C5").Text 'Populates January Income on MultiPage2 TextBox80.Text = Worksheets("Income").Range("B3").Text TextBox81.Text = Worksheets("Income").Range("C3").Text TextBox82.Text = Worksheets("Income").Range("D3").Text -- Dave Peterson -- Dave Peterson |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Initializing UserForm which uses MultiPage controls
Obviously - and that would have been yesterday's question, but obfuscation
with today's in my opinion. Since the OP was already trying to attribute failure with the shown code (which only addressed Multipage1) to not addressing Multipage2 --while all the information is correct, it alludes to some relationship, which there is none if the interest is only to activate a specific page on Multipage1. Thus my attempt to resolve clearly that there is no reason to worry about Multipage2 with the code shown. Which, for the edification of Simons, was tested with the exact code posted copied directly from the posting. -- Regards, Tom Ogilvy "Dave Peterson" wrote in message ... But if I wanted to see that page4 on multipage2, I did have to make that "parent" page active. Tom Ogilvy wrote: Note that if you excluded the parts about multipage2, it should still work. If you want to make a page active on multipage2, it doesn't make any difference whether the page on multipage1 is the activepage or not. So related to your specific question in this post, mentioning mutipage2 is superflous. If you do want to set it, then Dave has shown you additional code that can be used. -- Regards, Tom Ogilvy "Dave Peterson" wrote: I didn't need to in my little test. Are you sure your myMPPageName is holding the correct value? And if you're trying to get to the second page within that "sub-page", this worked ok for me: In a general module: Option Explicit Public myMPPage1Name As String Public myMPPage2Name As String Sub testme() myMPPage1Name = "Page2" myMPPage2Name = "Page4" UserForm1.Show End Sub Behind the userform: Option Explicit Private Sub UserForm_Initialize() With Me.MultiPage1 .Value = .Pages(myMPPage1Name).Index End With With Me.MultiPage2 .Value = .Pages(myMPPage2Name).Index End With End Sub In my testing, I added a multipage control with page1 and page2. Then I added another multipage control to page2 with page3 and page4. The initialization code showed page2, and page4 on that page. Patrick Simonds wrote: I am having a problem Initializing my UserForm which has on it 2 MultiPage controls. Before I added the second MultiPage control (which is located on Page2 of MultiPage1) everything worked fine. Now when I try to open the UserForm I get Object not found errors. I assume I must some how account for the second MultiPage control in the "With" statement, but nothing I have tried works. With Me.MultiPage1 .Value = .Pages(myMPPageName).Index End With Private Sub UserForm_Initialize() 'This macro intializes the Data Input UserForm With Me.MultiPage1 .Value = .Pages(myMPPageName).Index End With 'Populates the End of Period Data on MultiPage1 TextBox1.Text = Worksheets("Audit Report Page 1").Range("E4").Text TextBox2.Text = Worksheets("Audit Report Page 1").Range("E7").Text TextBox3.Text = Worksheets("Audit Report Page 1").Range("E8").Text 'Populates Outstanding Checks on MultiPage1 TextBox8.Text = Worksheets("Outstanding Checks").Range("A5").Text TextBox9.Text = Worksheets("Outstanding Checks").Range("B5").Text TextBox10.Text = Worksheets("Outstanding Checks").Range("C5").Text 'Populates January Income on MultiPage2 TextBox80.Text = Worksheets("Income").Range("B3").Text TextBox81.Text = Worksheets("Income").Range("C3").Text TextBox82.Text = Worksheets("Income").Range("D3").Text -- Dave Peterson -- Dave Peterson |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Initializing UserForm which uses MultiPage controls
My thoughts exactly <bg.
Tom Ogilvy wrote: Obviously - and that would have been yesterday's question, but obfuscation with today's in my opinion. Since the OP was already trying to attribute failure with the shown code (which only addressed Multipage1) to not addressing Multipage2 --while all the information is correct, it alludes to some relationship, which there is none if the interest is only to activate a specific page on Multipage1. Thus my attempt to resolve clearly that there is no reason to worry about Multipage2 with the code shown. Which, for the edification of Simons, was tested with the exact code posted copied directly from the posting. -- Regards, Tom Ogilvy "Dave Peterson" wrote in message ... But if I wanted to see that page4 on multipage2, I did have to make that "parent" page active. Tom Ogilvy wrote: Note that if you excluded the parts about multipage2, it should still work. If you want to make a page active on multipage2, it doesn't make any difference whether the page on multipage1 is the activepage or not. So related to your specific question in this post, mentioning mutipage2 is superflous. If you do want to set it, then Dave has shown you additional code that can be used. -- Regards, Tom Ogilvy "Dave Peterson" wrote: I didn't need to in my little test. Are you sure your myMPPageName is holding the correct value? And if you're trying to get to the second page within that "sub-page", this worked ok for me: In a general module: Option Explicit Public myMPPage1Name As String Public myMPPage2Name As String Sub testme() myMPPage1Name = "Page2" myMPPage2Name = "Page4" UserForm1.Show End Sub Behind the userform: Option Explicit Private Sub UserForm_Initialize() With Me.MultiPage1 .Value = .Pages(myMPPage1Name).Index End With With Me.MultiPage2 .Value = .Pages(myMPPage2Name).Index End With End Sub In my testing, I added a multipage control with page1 and page2. Then I added another multipage control to page2 with page3 and page4. The initialization code showed page2, and page4 on that page. Patrick Simonds wrote: I am having a problem Initializing my UserForm which has on it 2 MultiPage controls. Before I added the second MultiPage control (which is located on Page2 of MultiPage1) everything worked fine. Now when I try to open the UserForm I get Object not found errors. I assume I must some how account for the second MultiPage control in the "With" statement, but nothing I have tried works. With Me.MultiPage1 .Value = .Pages(myMPPageName).Index End With Private Sub UserForm_Initialize() 'This macro intializes the Data Input UserForm With Me.MultiPage1 .Value = .Pages(myMPPageName).Index End With 'Populates the End of Period Data on MultiPage1 TextBox1.Text = Worksheets("Audit Report Page 1").Range("E4").Text TextBox2.Text = Worksheets("Audit Report Page 1").Range("E7").Text TextBox3.Text = Worksheets("Audit Report Page 1").Range("E8").Text 'Populates Outstanding Checks on MultiPage1 TextBox8.Text = Worksheets("Outstanding Checks").Range("A5").Text TextBox9.Text = Worksheets("Outstanding Checks").Range("B5").Text TextBox10.Text = Worksheets("Outstanding Checks").Range("C5").Text 'Populates January Income on MultiPage2 TextBox80.Text = Worksheets("Income").Range("B3").Text TextBox81.Text = Worksheets("Income").Range("C3").Text TextBox82.Text = Worksheets("Income").Range("D3").Text -- Dave Peterson -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
stop userform from initializing | Excel Programming | |||
How to loop through controls on a MultiPage | Excel Programming | |||
Multipage Controls - Experts Only | Excel Programming | |||
Initializing Combobox in a Userform | Excel Programming | |||
Initializing Userform | Excel Programming |