+ Reply to Thread
Results 1 to 8 of 8

Adding a page to Multipage with code

  1. #1
    Registered User
    Join Date
    10-25-2016
    Location
    mumbai
    MS-Off Ver
    2010
    Posts
    47

    Adding a page to Multipage with code

    Hello guys,

    I have the following code where i create a Multipage and add pages to it using VBA. The code works fine till creating multipage. But adding page to it is a problem. I have followed excel help and used it in the following code.

    Private Sub UserForm_Initialize()

    Dim x As Control
    Dim y As Control


    Set x = UF2.Frame1.Controls.Add("Forms.Multipage.1", "MP")

    Set y = MP.Pages(0).Controls.Add("MSForms" _
    & ".TextBox.1", "x", Visible)


    End Sub

    Please help me with adding the pages.

    Thanks in Advance

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Adding a page to Multipage with code

    I would suggest you take a look and some of these links,
    there are more if you google the right text
    http://dailydoseofexcel.com/archives...ls-on-the-fly/
    http://www.ozgrid.com/Excel/free-tra...a2lesson21.htm
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Adding a page to Multipage with code

    That code doesn't add a page to a multipage, it adds a multipage to a frame and then appears to try to add a textbox to the first page of the multipage.

    If that's what you want to do try replacing MP.Pages(0) with x.Pages(0) in the second line of code.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    10-25-2016
    Location
    mumbai
    MS-Off Ver
    2010
    Posts
    47

    Re: Adding a page to Multipage with code

    Hello Norie,

    I want to add pages to the multipage I created.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Adding a page to Multipage with code

    This will add a multipage to Frame1 and then add a new page to it.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    10-25-2016
    Location
    mumbai
    MS-Off Ver
    2010
    Posts
    47

    Re: Adding a page to Multipage with code

    Thanks a lott Norie! How do you manage to find the commands?

  7. #7
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Adding a page to Multipage with code

    @Norie, nice

    This link also has a nice example to create an entire userform on-the-fly.
    Using other code you could customize it entirely to your needs.
    You will need access to the VBA project, it may not be hidden or password protected.
    http://stackoverflow.com/questions/1...dule-using-vba

  8. #8
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Adding a page to Multipage with code

    Of course, now you need to add the textbox

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. how to switch multipage page from multipage change event??
    By jed38 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-27-2015, 10:31 AM
  2. Replies: 4
    Last Post: 08-28-2014, 02:23 AM
  3. [SOLVED] Multipage Activex Control - How do I Embed Code in each Page?
    By vba_beginner in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-10-2013, 02:26 PM
  4. Hiding Content of specific Multipage page but not the page tab
    By kuraitori in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-15-2010, 03:42 AM
  5. Code runs only if a specific page of the MultiPage is selected
    By Gabor in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-18-2009, 07:18 PM
  6. Adding controls to each page in a multipage form
    By michael fuller in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-13-2006, 05:50 PM
  7. Adding frame on multipage through code...
    By Ajit in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-05-2005, 03:06 PM

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