+ Reply to Thread
Results 1 to 9 of 9

VBA, MultiPage with UserForm. Syntax issue. mousemove event.

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    471

    VBA, MultiPage with UserForm. Syntax issue. mousemove event.

    Hi
    I wonder if someone knows the correct syntax.

    Quite often I use some text boxes on my userforms to act as similar way as ControlTipText.
    E.g. If user hovers over labels they will see some tips so they can understand what they need to do (text boxes appear once user hovers on particular label - see code below).
    Private Sub Label4_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    Me.TextBox2.Text = "Choose end date:" & vbCrLf & vbCrLf & "" _
    & "Tip:" & vbCrLf & "" _
    & "Please ensure that the date selected genuinely exists within the calendar year." & vbCrLf & vbCrLf & "" _
    & "E.g. 31st April 2012 does not exist." & vbCrLf & ""
    Me.TextBox2.Visible = True
    End Sub



    I normally use userform mouse movement to hide/remove these text boxes again after user has moved away from the label using code below:

    Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    Me.TextBox1.Text = ""
    Me.TextBox1.Visible = False 
    Me.TextBox2.Text = ""
    Me.TextBox2.Visible = False
    End Sub
    How can I do the same thing but still be using multipage feature?
    I did try below (simply changing UserForm to MultiPage1) which does not work and errors out, lol.
    Private Sub MultiPage1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    I would appreciate if someone can share the secret of correct syntax as I quite like the multipage feature.

    Any ideas?

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA, MultiPage with UserForm. Syntax issue. mousemove event.

    Why not just use the ControlTipText Property?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    471

    Re: VBA, MultiPage with UserForm. Syntax issue. mousemove event.

    ControlTipText does not support multiple lines. The tips or instructions that I have on the userform are bit more detailed so ControlTipText does not work in my circumstances (the one line it does allow would become very long). Also ControlTipText doesn't allow any formating, I like white text on dark blue background, so as soon as the TextBox appears, it really sticks out on the userform.

    Any idea what the mousemove event sytnax for mulitpage could be?
    Last edited by rain4u; 04-21-2012 at 08:17 AM.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA, MultiPage with UserForm. Syntax issue. mousemove event.

    I'm not sure what problems you are having. The first mouse move example you've posted works fine on a multipage control

  5. #5
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    471

    Re: VBA, MultiPage with UserForm. Syntax issue. mousemove event.

    Hi
    I think the easiest option is just to demonstrate it.
    In the attached workbook there are two macro buttons which bring up two different userforms.
    The example 1 (Usual userform example) is regular userform.
    The example 2 (Userform Multipage example) is a userform with multi-page tab.

    Check how example 1 works to see how the tipboxes disappear after you have moved away from the label and you move on the userform, this is because the code below:
    Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    Me.TextBox1.Text = ""
    Me.TextBox1.Visible = False 
    Me.TextBox2.Text = ""
    Me.TextBox2.Visible = False
    End Sub
    Now check example 2
    How can I achieve the same thing that the Tipboxes disappear after you have moved away from the label and you move on the multi-page surface?



    All help is much appreciated.
    Attached Files Attached Files
    Last edited by rain4u; 04-21-2012 at 11:14 AM.

  6. #6
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    471

    Re: VBA, MultiPage with UserForm. Syntax issue. mousemove event.

    ***bump***

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA, MultiPage with UserForm. Syntax issue. mousemove event.

    To be honest when I have this situation I find it more effective to have a small help icon for the user to click which would open a message box or small userform

  8. #8
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: VBA, MultiPage with UserForm. Syntax issue. mousemove event.

    maybe
    Private Sub MultiPage1_MouseMove(ByVal Index As Long, ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    Me.TipBox1.Visible = False
    Me.TipBox2.Visible = False
    'or
    'Me.Controls("TipBox" & MultiPage1.Value + 1).Visible = False
    End Sub

  9. #9
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    471

    Re: VBA, MultiPage with UserForm. Syntax issue. mousemove event.

    Thak you Nilem. I can confirma that this works like great.
    Someone else might find this useful as far as I was able to Google, I couldn't find anything on the subject at least not in English.


    Cheers

+ 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