Consulting

Results 1 to 2 of 2

Thread: Solved: Forms - creating a wizard with moving parts

  1. #1
    VBAX Tutor
    Joined
    Nov 2007
    Posts
    291
    Location

    Solved: Forms - creating a wizard with moving parts

    Hello,

    Is it possible using a Userform to create a wizard that has moving parts like Excel 2003's Pivottable wizard (i.e. labels with field names can be moved and dropped into the pivottable zones). I have tried it with labels but they are fixed when the Form is displayed

    Any help would, as always, be appreciated

    All the best
    Phil

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    If you put this in a userform's code module, you can drag Label1 around the userform with the mouse.
    [VBA]Dim xNull As Long, yNull As Long
    Dim Work As Boolean

    Private Sub Label1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
    xNull = x
    yNull = y
    Work = True
    End Sub

    Private Sub Label1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
    If Work Then
    With Label1
    .Left = .Left + (x - xNull)
    .Top = .Top + (y - yNull)
    End With
    End If
    End Sub

    Private Sub Label1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
    Work = False
    End Sub
    [/VBA]

Posting Permissions

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