Ozgrid Excel Help Forums & Excel Best Practices


XL Templates | XL Add-ins | XL Training | XL Estimating | XL Scheduling | XL Recovery | XL Trading | XL Financial | XL Conversion | XL Charting


<
+ Reply to Thread
Results 1 to 2 of 2

Thread: How to make a form Unmovable?

  1. #1
    Join Date
    30th March 2005
    Location
    California
    Posts
    200

    How to make a form Unmovable?

    I am trying to keep my form fixed (the user cannot move it around) is this possible? how?

    thanks in advance

  2. #2
    Join Date
    7th March 2003
    Location
    Essex, England
    Posts
    11,319

    Re: How to make a form Unmovable?


    Create Excel dashboards quickly with Plug-N-Play reports.
    Hi,

    Here a non API way to keep the userform in the same position as when activated.
    Add this to the userform code module.
    Code:
    Option Explicit
    
    Private m_sngAnchorLeft As Single
    Private m_sngAnchorTop As Single
    Private m_blnSetAnchor As Boolean
    Private Sub UserForm_Activate()
        If Me.Visible Then
            If Not m_blnSetAnchor Then
                m_sngAnchorLeft = Me.Left
                m_sngAnchorTop = Me.Top
                m_blnSetAnchor = True
            End If
        End If
    End Sub
    
    Private Sub UserForm_Deactivate()
    
        m_blnSetAnchor = False
        
    End Sub
    
    Private Sub UserForm_Layout()
    
        If m_blnSetAnchor Then
            Me.Left = m_sngAnchorLeft
            Me.Top = m_sngAnchorTop
        End If
        
    End Sub

    Cheers
    Andy


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

     

Possible Answers

  1. Watch this: Make a control move as you resize a form
    By Dave Hawley in forum Access RSS Feed Discussions
    Replies: 0
    Last Post: April 10th, 2008, 11:50
  2. Form to make list of part #'s & date
    By timandjes in forum EXCEL HELP
    Replies: 5
    Last Post: May 27th, 2006, 10:31
  3. Help making a cell unmovable and unsortable
    By wagman in forum EXCEL HELP
    Replies: 2
    Last Post: November 14th, 2005, 11:38
  4. How to make my form more user friendly - Help Files
    By GarethBradley in forum EXCEL HELP
    Replies: 1
    Last Post: May 24th, 2005, 04:17
  5. Replies: 4
    Last Post: March 19th, 2004, 21:59

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