Results 1 to 3 of 3

Positioning multiple command buttons on a userform using VBA

Threaded View

newbi004 Positioning multiple command... 11-04-2012, 05:39 AM
HSV Re: Positioning multiple... 11-04-2012, 12:31 PM
newbi004 Re: Positioning multiple... 11-04-2012, 04:13 PM
  1. #2
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    879

    Re: Positioning multiple command buttons on a userform using VBA

    This might help you on your way.
    Play something.

    Option Explicit
    Public com1left, com1top, com1width, com1height, com2left, com2top, com2width, com2height
    Private Sub CommandButton1_Click()
     CommandButton1.Move com1left, 10, com1width, com1height
     CommandButton2.Move com2height, com2left, com2top, com2width
     CommandButton2.WordWrap = True
    End Sub
    
    Private Sub CommandButton2_Click()
     CommandButton2.Move com2left, 10, com2width, com2height
     CommandButton1.Move com2height, com2left, com2top, com2width
     CommandButton1.WordWrap = True
    End Sub
    
    Private Sub UserForm_Activate() 
    'setting position of each Commandbutton
    
    com1left = CommandButton1.Left
        com1top = CommandButton1.Top
        com1width = CommandButton1.Width
        com1height = CommandButton1.Height
        
        com2left = CommandButton2.Left
        com2top = CommandButton2.Top
        com2width = CommandButton2.Width
        com2height = CommandButton2.Height
    End Sub
    Attached Files Attached Files
    Harry.

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