+ Reply to Thread
Results 1 to 8 of 8

Execl VBA:How to retain with the values in Textboxes in userform while switching btw pages

  1. #1
    Registered User
    Join Date
    03-12-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    5

    Execl VBA:How to retain with the values in Textboxes in userform while switching btw pages

    EXCEL VER. 2003

    I am populating my userform fields from a word documents. I have three pages in my userform. When I change something in the field that is being populated from the word and after that i move to next page. And when i return back to previous page all the changes are gone.


    Could you please help to retain these values.

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Execl VBA:How to retain with the values in Textboxes in userform while switching btw p

    That shouldn't happen unless you have code that makes it happen. Do you have code in the multipage change event?
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    03-12-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    5

    Unhappy Re: Execl VBA:How to retain with the values in Textboxes in userform while switching btw p

    Thanks for you Kind Reply.

    I have only written this.

    Private Sub NextPage1_Click()
    page1.Hide
    page2.Show
    End Sub

    Please tell me if anything else I should code here so as to keep my values unchaged while swaping.

    Note: One thing more, the values that i am not populating from word document are not changing, only the values that I am populating from word remains fixed after if I make changes also.

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Execl VBA:How to retain with the values in Textboxes in userform while switching btw p

    There must be more code than that if you're populating it from Word.

    Why are you hiding pages rather than just incrementing the value of the Multipage?

  5. #5
    Registered User
    Join Date
    03-12-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Execl VBA:How to retain with the values in Textboxes in userform while switching btw p

    Sir ,

    Actually the thing is that i am importing the word in excel by a macro and then from excel I am populating in userform and then after that I am doing all the validations and the whole process. So I found the idea of using this HIDE utility.

    Please correct me if my idea is incorrect.

  6. #6
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Execl VBA:How to retain with the values in Textboxes in userform while switching btw p

    Now that I've woken up, it appears you are actually using separate forms, not a multipage control, since the Page object doesn't have Hide or Show methods.

    Unless you post all the code you are using, we would just be guessing at why your data disappears.

  7. #7
    Registered User
    Join Date
    03-12-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Execl VBA:How to retain with the values in Textboxes in userform while switching btw p

    Hi ,

    This is the code how i am fetching the data from excel.

    page1.TextBox3 = Sheets("Data").Range("AL2")



    This is the code I am using to go to next form. This field is automatically populated from Excel Sheet and then I want to change something in Textbox3. Whenevr i change and proceed to the next page and as soon as i come back that change disappears.

    Private Sub NextPage1_Click()
    If Me.TextBox3.Value = "" Then
    page1.TextBox3.BackColor = RGB(255, 102, 102)
    Me.TextBox3.SetFocus
    MsgBox "This field can't be left blank", vbOKOnly, "Required Field"
    Exit Sub
    Else: page1.TextBox3.BackColor = RGB(255, 255, 255)
    End If

    If Not IsNumeric(page1.TextBox3) And page1.TextBox3 <> vbNullString Then

    page1.TextBox3.BackColor = RGB(255, 102, 102)
    MsgBox "Sorry, only numbers allowed"
    'page1.TextBox3 = vbNullString

    Exit Sub
    End If

    page1.Hide
    page2.Show

    End Sub

  8. #8
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Execl VBA:How to retain with the values in Textboxes in userform while switching btw p

    Please post a workbook so that we can see all the code.

+ 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. Replies: 4
    Last Post: 09-08-2013, 07:40 PM
  2. [SOLVED] How to i validate if all the values entered in userform textboxes are valid then execute.
    By amethystfeb in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-01-2013, 12:33 PM
  3. Userform Textboxes showing wrong values?
    By Panic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-18-2008, 09:43 PM
  4. Capture worksheet switching inside userform and update textboxes to new sheet
    By RockiesMan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-21-2007, 05:10 PM
  5. Switching between textboxes
    By jcup in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-05-2007, 04:39 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