+ Reply to Thread
Results 1 to 6 of 6

Adding controls to each page in a multipage form

Hybrid View

Guest Adding controls to each page... 01-13-2006, 12:40 PM
Guest Re: Adding controls to each... 01-13-2006, 01:40 PM
Guest Re: Adding controls to each... 01-13-2006, 02:10 PM
Guest Re: Adding controls to each... 01-13-2006, 02:55 PM
Guest Re: Adding controls to each... 01-13-2006, 04:45 PM
Guest Re: Adding controls to each... 01-13-2006, 05:50 PM
  1. #1
    michael fuller
    Guest

    Adding controls to each page in a multipage form

    Hi All,

    I was wondering if there was anyone out there who can help me?

    I have a worksheet with Group names populated in Coloumn "A"

    A B

    1 Group1 Value 1
    2 Group2 Value 2
    etc

    the cell "A1" has a name defined as "Start"

    I have wirtten come code that will allow this list to expand as required ie.
    more groups are added.
    and another piece that will display a form with a multipage create a new
    page for each entry in coloum "A". with the group name as the caption.

    Now I am stuck.... I cannot work out how to add a textbox to each of the
    pages as it is created. The idea being that the box will display the data
    contained in coloumn "B"

    Having consulted the "Help" file I am now totally confused especially as the
    code provided within does not seem to work when I create the example.
    The code I am using is as follows

    Sub test()

    Dim name As String
    Dim counter As Integer
    counter = 0
    Range("start").Select
    Do Until ActiveCell = ""
    Range("offset(start," & counter & ",0)").Select
    If ActiveCell <> "" Then
    name = ActiveCell
    UserForm1.MultiPage1.Pages.Add (name)
    '
    ' Code to set up pages goes here (I think)
    '
    '
    End If
    counter = counter + 1
    Loop
    UserForm1.Show

    End Sub

    Can anyone Help me please???

    Regards and Thanks

    Mick




  2. #2
    Bob Phillips
    Guest

    Re: Adding controls to each page in a multipage form

    Is this what you want

    Dim sName As String
    Dim counter As Integer
    Dim oMP As MultiPage
    Dim NewButton As MSForms.TextBox

    counter = 0
    Set oMP = UserForm1.MultiPage1
    With Range("start")
    Do Until .Offset(counter, 0).Value = ""
    sName = .Offset(counter, 0).Value
    If counter < 2 Then
    oMP.Pages(counter).Caption = sName
    Else
    oMP.Pages.Add (sName)
    End If
    Set NewButton =
    oMP.Pages(counter).Controls.Add("Forms.Textbox.1")
    NewButton.name = "txt" & sName
    NewButton.Text = .Offset(counter, 1).Value
    NewButton.Left = 20
    NewButton.Top = 20
    counter = counter + 1
    Loop
    End With
    UserForm1.Show


    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "michael fuller" <michael.fullertwo@ntlworld.com> wrote in message
    news:7BQxf.67538$Cj5.46545@newsfe6-win.ntli.net...
    > Hi All,
    >
    > I was wondering if there was anyone out there who can help me?
    >
    > I have a worksheet with Group names populated in Coloumn "A"
    >
    > A B
    >
    > 1 Group1 Value 1
    > 2 Group2 Value 2
    > etc
    >
    > the cell "A1" has a name defined as "Start"
    >
    > I have wirtten come code that will allow this list to expand as required

    ie.
    > more groups are added.
    > and another piece that will display a form with a multipage create a new
    > page for each entry in coloum "A". with the group name as the caption.
    >
    > Now I am stuck.... I cannot work out how to add a textbox to each of the
    > pages as it is created. The idea being that the box will display the data
    > contained in coloumn "B"
    >
    > Having consulted the "Help" file I am now totally confused especially as

    the
    > code provided within does not seem to work when I create the example.
    > The code I am using is as follows
    >
    > Sub test()
    >
    > Dim name As String
    > Dim counter As Integer
    > counter = 0
    > Range("start").Select
    > Do Until ActiveCell = ""
    > Range("offset(start," & counter & ",0)").Select
    > If ActiveCell <> "" Then
    > name = ActiveCell
    > UserForm1.MultiPage1.Pages.Add (name)
    > '
    > ' Code to set up pages goes here (I think)
    > '
    > '
    > End If
    > counter = counter + 1
    > Loop
    > UserForm1.Show
    >
    > End Sub
    >
    > Can anyone Help me please???
    >
    > Regards and Thanks
    >
    > Mick
    >
    >
    >




  3. #3
    michael fuller
    Guest

    Re: Adding controls to each page in a multipage form

    Hi Bob,

    Thanks for the reply. Unfortunatly I get an "Invalid procedure call or
    argument" error with the following line

    oMP.Pages(counter).Caption = sName

    I am using Excel 2000... would this account for the error?

    Regards and Thanks

    Mick

    "Bob Phillips" <bob.phillips@notheretiscali.co.uk> wrote in message
    news:O8m4SdGGGHA.3976@TK2MSFTNGP11.phx.gbl...
    > Is this what you want
    >
    > Dim sName As String
    > Dim counter As Integer
    > Dim oMP As MultiPage
    > Dim NewButton As MSForms.TextBox
    >
    > counter = 0
    > Set oMP = UserForm1.MultiPage1
    > With Range("start")
    > Do Until .Offset(counter, 0).Value = ""
    > sName = .Offset(counter, 0).Value
    > If counter < 2 Then
    > oMP.Pages(counter).Caption = sName
    > Else
    > oMP.Pages.Add (sName)
    > End If
    > Set NewButton =
    > oMP.Pages(counter).Controls.Add("Forms.Textbox.1")
    > NewButton.name = "txt" & sName
    > NewButton.Text = .Offset(counter, 1).Value
    > NewButton.Left = 20
    > NewButton.Top = 20
    > counter = counter + 1
    > Loop
    > End With
    > UserForm1.Show
    >
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (remove nothere from email address if mailing direct)
    >
    > "michael fuller" <michael.fullertwo@ntlworld.com> wrote in message
    > news:7BQxf.67538$Cj5.46545@newsfe6-win.ntli.net...
    >> Hi All,
    >>
    >> I was wondering if there was anyone out there who can help me?
    >>
    >> I have a worksheet with Group names populated in Coloumn "A"
    >>
    >> A B
    >>
    >> 1 Group1 Value 1
    >> 2 Group2 Value 2
    >> etc
    >>
    >> the cell "A1" has a name defined as "Start"
    >>
    >> I have wirtten come code that will allow this list to expand as required

    > ie.
    >> more groups are added.
    >> and another piece that will display a form with a multipage create a new
    >> page for each entry in coloum "A". with the group name as the caption.
    >>
    >> Now I am stuck.... I cannot work out how to add a textbox to each of the
    >> pages as it is created. The idea being that the box will display the data
    >> contained in coloumn "B"
    >>
    >> Having consulted the "Help" file I am now totally confused especially as

    > the
    >> code provided within does not seem to work when I create the example.
    >> The code I am using is as follows
    >>
    >> Sub test()
    >>
    >> Dim name As String
    >> Dim counter As Integer
    >> counter = 0
    >> Range("start").Select
    >> Do Until ActiveCell = ""
    >> Range("offset(start," & counter & ",0)").Select
    >> If ActiveCell <> "" Then
    >> name = ActiveCell
    >> UserForm1.MultiPage1.Pages.Add (name)
    >> '
    >> ' Code to set up pages goes here (I think)
    >> '
    >> '
    >> End If
    >> counter = counter + 1
    >> Loop
    >> UserForm1.Show
    >>
    >> End Sub
    >>
    >> Can anyone Help me please???
    >>
    >> Regards and Thanks
    >>
    >> Mick
    >>
    >>
    >>

    >
    >




  4. #4
    Bob Phillips
    Guest

    Re: Adding controls to each page in a multipage form

    Mick,

    I have just loaded up Excel 2000 and that code works fine for me there.

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "michael fuller" <michael.fullertwo@ntlworld.com> wrote in message
    news:cYRxf.91489$a15.23738@newsfe5-win.ntli.net...
    > Hi Bob,
    >
    > Thanks for the reply. Unfortunatly I get an "Invalid procedure call or
    > argument" error with the following line
    >
    > oMP.Pages(counter).Caption = sName
    >
    > I am using Excel 2000... would this account for the error?
    >
    > Regards and Thanks
    >
    > Mick
    >
    > "Bob Phillips" <bob.phillips@notheretiscali.co.uk> wrote in message
    > news:O8m4SdGGGHA.3976@TK2MSFTNGP11.phx.gbl...
    > > Is this what you want
    > >
    > > Dim sName As String
    > > Dim counter As Integer
    > > Dim oMP As MultiPage
    > > Dim NewButton As MSForms.TextBox
    > >
    > > counter = 0
    > > Set oMP = UserForm1.MultiPage1
    > > With Range("start")
    > > Do Until .Offset(counter, 0).Value = ""
    > > sName = .Offset(counter, 0).Value
    > > If counter < 2 Then
    > > oMP.Pages(counter).Caption = sName
    > > Else
    > > oMP.Pages.Add (sName)
    > > End If
    > > Set NewButton =
    > > oMP.Pages(counter).Controls.Add("Forms.Textbox.1")
    > > NewButton.name = "txt" & sName
    > > NewButton.Text = .Offset(counter, 1).Value
    > > NewButton.Left = 20
    > > NewButton.Top = 20
    > > counter = counter + 1
    > > Loop
    > > End With
    > > UserForm1.Show
    > >
    > >
    > > --
    > > HTH
    > >
    > > Bob Phillips
    > >
    > > (remove nothere from email address if mailing direct)
    > >
    > > "michael fuller" <michael.fullertwo@ntlworld.com> wrote in message
    > > news:7BQxf.67538$Cj5.46545@newsfe6-win.ntli.net...
    > >> Hi All,
    > >>
    > >> I was wondering if there was anyone out there who can help me?
    > >>
    > >> I have a worksheet with Group names populated in Coloumn "A"
    > >>
    > >> A B
    > >>
    > >> 1 Group1 Value 1
    > >> 2 Group2 Value 2
    > >> etc
    > >>
    > >> the cell "A1" has a name defined as "Start"
    > >>
    > >> I have wirtten come code that will allow this list to expand as

    required
    > > ie.
    > >> more groups are added.
    > >> and another piece that will display a form with a multipage create a

    new
    > >> page for each entry in coloum "A". with the group name as the caption.
    > >>
    > >> Now I am stuck.... I cannot work out how to add a textbox to each of

    the
    > >> pages as it is created. The idea being that the box will display the

    data
    > >> contained in coloumn "B"
    > >>
    > >> Having consulted the "Help" file I am now totally confused especially

    as
    > > the
    > >> code provided within does not seem to work when I create the example.
    > >> The code I am using is as follows
    > >>
    > >> Sub test()
    > >>
    > >> Dim name As String
    > >> Dim counter As Integer
    > >> counter = 0
    > >> Range("start").Select
    > >> Do Until ActiveCell = ""
    > >> Range("offset(start," & counter & ",0)").Select
    > >> If ActiveCell <> "" Then
    > >> name = ActiveCell
    > >> UserForm1.MultiPage1.Pages.Add (name)
    > >> '
    > >> ' Code to set up pages goes here (I think)
    > >> '
    > >> '
    > >> End If
    > >> counter = counter + 1
    > >> Loop
    > >> UserForm1.Show
    > >>
    > >> End Sub
    > >>
    > >> Can anyone Help me please???
    > >>
    > >> Regards and Thanks
    > >>
    > >> Mick
    > >>
    > >>
    > >>

    > >
    > >

    >
    >




  5. #5
    Michael Fuller
    Guest

    Re: Adding controls to each page in a multipage form

    Hmmm... I wonder if there is an Add in that I should be using then?


    "Bob Phillips" <bob.phillips@notheretiscali.co.uk> wrote in message
    news:%23D4nnGHGGHA.1124@TK2MSFTNGP10.phx.gbl...
    > Mick,
    >
    > I have just loaded up Excel 2000 and that code works fine for me there.
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (remove nothere from email address if mailing direct)
    >
    > "michael fuller" <michael.fullertwo@ntlworld.com> wrote in message
    > news:cYRxf.91489$a15.23738@newsfe5-win.ntli.net...
    >> Hi Bob,
    >>
    >> Thanks for the reply. Unfortunatly I get an "Invalid procedure call or
    >> argument" error with the following line
    >>
    >> oMP.Pages(counter).Caption = sName
    >>
    >> I am using Excel 2000... would this account for the error?
    >>
    >> Regards and Thanks
    >>
    >> Mick
    >>
    >> "Bob Phillips" <bob.phillips@notheretiscali.co.uk> wrote in message
    >> news:O8m4SdGGGHA.3976@TK2MSFTNGP11.phx.gbl...
    >> > Is this what you want
    >> >
    >> > Dim sName As String
    >> > Dim counter As Integer
    >> > Dim oMP As MultiPage
    >> > Dim NewButton As MSForms.TextBox
    >> >
    >> > counter = 0
    >> > Set oMP = UserForm1.MultiPage1
    >> > With Range("start")
    >> > Do Until .Offset(counter, 0).Value = ""
    >> > sName = .Offset(counter, 0).Value
    >> > If counter < 2 Then
    >> > oMP.Pages(counter).Caption = sName
    >> > Else
    >> > oMP.Pages.Add (sName)
    >> > End If
    >> > Set NewButton =
    >> > oMP.Pages(counter).Controls.Add("Forms.Textbox.1")
    >> > NewButton.name = "txt" & sName
    >> > NewButton.Text = .Offset(counter, 1).Value
    >> > NewButton.Left = 20
    >> > NewButton.Top = 20
    >> > counter = counter + 1
    >> > Loop
    >> > End With
    >> > UserForm1.Show
    >> >
    >> >
    >> > --
    >> > HTH
    >> >
    >> > Bob Phillips
    >> >
    >> > (remove nothere from email address if mailing direct)
    >> >
    >> > "michael fuller" <michael.fullertwo@ntlworld.com> wrote in message
    >> > news:7BQxf.67538$Cj5.46545@newsfe6-win.ntli.net...
    >> >> Hi All,
    >> >>
    >> >> I was wondering if there was anyone out there who can help me?
    >> >>
    >> >> I have a worksheet with Group names populated in Coloumn "A"
    >> >>
    >> >> A B
    >> >>
    >> >> 1 Group1 Value 1
    >> >> 2 Group2 Value 2
    >> >> etc
    >> >>
    >> >> the cell "A1" has a name defined as "Start"
    >> >>
    >> >> I have wirtten come code that will allow this list to expand as

    > required
    >> > ie.
    >> >> more groups are added.
    >> >> and another piece that will display a form with a multipage create a

    > new
    >> >> page for each entry in coloum "A". with the group name as the caption.
    >> >>
    >> >> Now I am stuck.... I cannot work out how to add a textbox to each of

    > the
    >> >> pages as it is created. The idea being that the box will display the

    > data
    >> >> contained in coloumn "B"
    >> >>
    >> >> Having consulted the "Help" file I am now totally confused especially

    > as
    >> > the
    >> >> code provided within does not seem to work when I create the example.
    >> >> The code I am using is as follows
    >> >>
    >> >> Sub test()
    >> >>
    >> >> Dim name As String
    >> >> Dim counter As Integer
    >> >> counter = 0
    >> >> Range("start").Select
    >> >> Do Until ActiveCell = ""
    >> >> Range("offset(start," & counter & ",0)").Select
    >> >> If ActiveCell <> "" Then
    >> >> name = ActiveCell
    >> >> UserForm1.MultiPage1.Pages.Add (name)
    >> >> '
    >> >> ' Code to set up pages goes here (I think)
    >> >> '
    >> >> '
    >> >> End If
    >> >> counter = counter + 1
    >> >> Loop
    >> >> UserForm1.Show
    >> >>
    >> >> End Sub
    >> >>
    >> >> Can anyone Help me please???
    >> >>
    >> >> Regards and Thanks
    >> >>
    >> >> Mick
    >> >>
    >> >>
    >> >>
    >> >
    >> >

    >>
    >>

    >
    >




  6. #6
    Bob Phillips
    Guest

    Re: Adding controls to each page in a multipage form

    Why don't you post me your workbook to look at?

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "Michael Fuller" <michael.fuller1@ntlworld.com> wrote in message
    news:8hUxf.91542$7p5.25570@newsfe4-win.ntli.net...
    > Hmmm... I wonder if there is an Add in that I should be using then?
    >
    >
    > "Bob Phillips" <bob.phillips@notheretiscali.co.uk> wrote in message
    > news:%23D4nnGHGGHA.1124@TK2MSFTNGP10.phx.gbl...
    > > Mick,
    > >
    > > I have just loaded up Excel 2000 and that code works fine for me there.
    > >
    > > --
    > > HTH
    > >
    > > Bob Phillips
    > >
    > > (remove nothere from email address if mailing direct)
    > >
    > > "michael fuller" <michael.fullertwo@ntlworld.com> wrote in message
    > > news:cYRxf.91489$a15.23738@newsfe5-win.ntli.net...
    > >> Hi Bob,
    > >>
    > >> Thanks for the reply. Unfortunatly I get an "Invalid procedure call or
    > >> argument" error with the following line
    > >>
    > >> oMP.Pages(counter).Caption = sName
    > >>
    > >> I am using Excel 2000... would this account for the error?
    > >>
    > >> Regards and Thanks
    > >>
    > >> Mick
    > >>
    > >> "Bob Phillips" <bob.phillips@notheretiscali.co.uk> wrote in message
    > >> news:O8m4SdGGGHA.3976@TK2MSFTNGP11.phx.gbl...
    > >> > Is this what you want
    > >> >
    > >> > Dim sName As String
    > >> > Dim counter As Integer
    > >> > Dim oMP As MultiPage
    > >> > Dim NewButton As MSForms.TextBox
    > >> >
    > >> > counter = 0
    > >> > Set oMP = UserForm1.MultiPage1
    > >> > With Range("start")
    > >> > Do Until .Offset(counter, 0).Value = ""
    > >> > sName = .Offset(counter, 0).Value
    > >> > If counter < 2 Then
    > >> > oMP.Pages(counter).Caption = sName
    > >> > Else
    > >> > oMP.Pages.Add (sName)
    > >> > End If
    > >> > Set NewButton =
    > >> > oMP.Pages(counter).Controls.Add("Forms.Textbox.1")
    > >> > NewButton.name = "txt" & sName
    > >> > NewButton.Text = .Offset(counter, 1).Value
    > >> > NewButton.Left = 20
    > >> > NewButton.Top = 20
    > >> > counter = counter + 1
    > >> > Loop
    > >> > End With
    > >> > UserForm1.Show
    > >> >
    > >> >
    > >> > --
    > >> > HTH
    > >> >
    > >> > Bob Phillips
    > >> >
    > >> > (remove nothere from email address if mailing direct)
    > >> >
    > >> > "michael fuller" <michael.fullertwo@ntlworld.com> wrote in message
    > >> > news:7BQxf.67538$Cj5.46545@newsfe6-win.ntli.net...
    > >> >> Hi All,
    > >> >>
    > >> >> I was wondering if there was anyone out there who can help me?
    > >> >>
    > >> >> I have a worksheet with Group names populated in Coloumn "A"
    > >> >>
    > >> >> A B
    > >> >>
    > >> >> 1 Group1 Value 1
    > >> >> 2 Group2 Value 2
    > >> >> etc
    > >> >>
    > >> >> the cell "A1" has a name defined as "Start"
    > >> >>
    > >> >> I have wirtten come code that will allow this list to expand as

    > > required
    > >> > ie.
    > >> >> more groups are added.
    > >> >> and another piece that will display a form with a multipage create a

    > > new
    > >> >> page for each entry in coloum "A". with the group name as the

    caption.
    > >> >>
    > >> >> Now I am stuck.... I cannot work out how to add a textbox to each

    of
    > > the
    > >> >> pages as it is created. The idea being that the box will display the

    > > data
    > >> >> contained in coloumn "B"
    > >> >>
    > >> >> Having consulted the "Help" file I am now totally confused

    especially
    > > as
    > >> > the
    > >> >> code provided within does not seem to work when I create the

    example.
    > >> >> The code I am using is as follows
    > >> >>
    > >> >> Sub test()
    > >> >>
    > >> >> Dim name As String
    > >> >> Dim counter As Integer
    > >> >> counter = 0
    > >> >> Range("start").Select
    > >> >> Do Until ActiveCell = ""
    > >> >> Range("offset(start," & counter & ",0)").Select
    > >> >> If ActiveCell <> "" Then
    > >> >> name = ActiveCell
    > >> >> UserForm1.MultiPage1.Pages.Add (name)
    > >> >> '
    > >> >> ' Code to set up pages goes here (I think)
    > >> >> '
    > >> >> '
    > >> >> End If
    > >> >> counter = counter + 1
    > >> >> Loop
    > >> >> UserForm1.Show
    > >> >>
    > >> >> End Sub
    > >> >>
    > >> >> Can anyone Help me please???
    > >> >>
    > >> >> Regards and Thanks
    > >> >>
    > >> >> Mick
    > >> >>
    > >> >>
    > >> >>
    > >> >
    > >> >
    > >>
    > >>

    > >
    > >

    >
    >




+ 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