+ Reply to Thread
Results 1 to 10 of 10

multipage controls not working

  1. #1
    Registered User
    Join Date
    05-02-2012
    Location
    LeftCoast
    MS-Off Ver
    Excel 2007
    Posts
    33

    multipage controls not working

    Hello All,

    I am trying to enter data onto a spreadsheet using a UserForm with controls on a multipage control. My combo boxes work when placed directly on the UserForm, but do not work when placed on a Multipage on the UserForm.

    My code for the latter is:

    Private Sub OKButton_Click()
    ActiveWorkbook.Sheets("Sheet1").Activate
    Range("E8").Select

    ActiveCell.Offset(0, 0) = MultiPage1.Page1.ComboBox1.Value
    ActiveCell.Offset(1, 0) = MultiPage1.Page1.ComboBox2.Value
    ActiveCell.Offset(2, 0) = MultiPage1.Page1.ComboBox3.Value
    ActiveCell.Offset(3, 0) = MultiPage1.Page1.ComboBox4.Value
    ActiveCell.Offset(4, 0) = MultiPage1.Page1.ComboBox5.Value
    MultiPage1.Page1.ComboBox1.Text = ""
    MultiPage1.Page1.ComboBox2.Text = ""
    MultiPage1.Page1.ComboBox3.Text = ""
    MultiPage1.Page1.ComboBox4.Text = ""
    MultiPage1.Page1.ComboBox5.Text = ""
    MultiPage1.Page1.ComboBox1.SetFocus
    End Sub

    the above does not work when combo boxes are on a Multipage.

    Private Sub OKButton_Click()
    ActiveWorkbook.Sheets("Sheet1").Activate
    Range("E8").Select

    ActiveCell.Offset(0, 0) = ComboBox1.Value
    ActiveCell.Offset(1, 0) = ComboBox2.Value
    ActiveCell.Offset(2, 0) = ComboBox3.Value
    ActiveCell.Offset(3, 0) = ComboBox4.Value
    ActiveCell.Offset(4, 0) = ComboBox5.Value
    ComboBox1.Text = ""
    ComboBox2.Text = ""
    ComboBox3.Text = ""
    ComboBox4.Text = ""
    ComboBox5.Text = ""
    ComboBox1.SetFocus
    End Sub

    The above DOES] work when placed directly on the UserForm.

    Any help would be appreciated as this is the first time that I have tried to use Multipage and my project requires several of them.

    Thanks!

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: multipage controls not working

    why do you think you need to change the code from the original?
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    05-02-2012
    Location
    LeftCoast
    MS-Off Ver
    Excel 2007
    Posts
    33

    Re: multipage controls not working

    Joseph, thanks for the reply.

    At first I did not think that I had to change the code. But the moment I put the comboboxes on the multipage, the userform stopped working.

    Then I thought I had to cover all objects such as the multipage and the page number.

    As you can probably tell, I am quite new to this VBA thing.

    Thanks.

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: multipage controls not working

    you should not have to change the code. what was the error when you put the controls on the multipage?

  5. #5
    Registered User
    Join Date
    05-02-2012
    Location
    LeftCoast
    MS-Off Ver
    Excel 2007
    Posts
    33

    Re: multipage controls not working

    Runtime error 424 Object Required and it highlights this line when I hit debug

    ActiveCell.Offset(0, 0) = ComboBox1.Value

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: multipage controls not working

    did you add new controls or move the old ones? I assume this code is in the userform itself?

  7. #7
    Registered User
    Join Date
    05-02-2012
    Location
    LeftCoast
    MS-Off Ver
    Excel 2007
    Posts
    33

    Re: multipage controls not working

    I have played with this so much, I think I used the old ones and slipped them onto the multipage. The code is for the OKButton on the UserForm so is in the userform.

    thanks.

  8. #8
    Registered User
    Join Date
    05-02-2012
    Location
    LeftCoast
    MS-Off Ver
    Excel 2007
    Posts
    33

    Re: multipage controls not working

    I am also getting an occasional warning when the userform opens up, maybe 1 time in 10 that says "not enough system resources to display properly" the caption is for Excel. I don't think this is pertinent, but grasping at straws at this point....

  9. #9
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: multipage controls not working

    if you type
    Me.
    in front of the combobox1 word, does combobox1 appear in the intellisense dropdown list?

  10. #10
    Registered User
    Join Date
    05-02-2012
    Location
    LeftCoast
    MS-Off Ver
    Excel 2007
    Posts
    33

    Re: multipage controls not working

    No it does not, other combobox numbers appear. I think I created a bunch of boxes, erased some, and might have renamed others. I am going to start over by erasing existing boxes and creating new ones. Works great now! Thanks very much! It was the box names and the adding of the Me.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1