Por favor, cómo fijar la posición de un formulario?...

Samuel Cano

Board Regular
Joined
Jun 24, 2002
Messages
62
Por favor alguien me puede orientar cómo fijar un formulario en la pantalla?

Cuando se ejecuta por primera vez aparece centrado en la pantalla y eso está bien...

lo que quiero evitar es que los usuarios puedan desplazar el formulario por la pantalla, porque eso me está ocasionando problemas...

Gracias.

- Samuel
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Gracias

Hola Greg,

voy a revisar el post ( mira que según yo, busqué antes de preguntar)...

:lol:

hasta pronto y buen fin de semana.

- Samuel
 
Upvote 0
Greg, funcionó muy bién...

aquí el código para fijar la posición de un formulario (userform) en la pantalla, por si alguien lo necesita de rápido:

Extraído del mensaje original:

This seems to work ok:
Code:
Option Explicit

Private Type Position
    Left As Single
    Top As Single
End Type

Private Sub UserForm_Layout()
    Static Pos As Position

    Dim Mvd As Boolean
    
    'If the form is just being initialized, store the position
    If Pos.Left = 0 Or Pos.Top = 0 Then
        Pos.Left = Me.Left
        Pos.Top = Me.Top
        Exit Sub
    End If
    
    'Check to see if the form has been moved
    Mvd = False
    If Me.Left <> Pos.Left Then
        Me.Left = Pos.Left
        Mvd = True
    End If
    If Me.Top <> Pos.Top Then
        Me.Top = Pos.Top
        Mvd = True
    End If
    
    If Mvd Then
        MsgBox "Please don't move me !", vbCritical
    End If
End Sub
~Juan Pablo González

Gracias a Juan Pablo por el código y a ti por orientarme hacia él.

Un abrazo.

- Samuel
 
Upvote 0

Forum statistics

Threads
1,223,978
Messages
6,175,754
Members
452,667
Latest member
vanessavalentino83

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top