![]() |
Blocking Access to Sheet
Hi Community !
I have in my initial UserForm the following code to take all the screen: Me.Height = Application.Height Me.Width = Application.Width BUT, I've realized that users can move this UF and change the sheets with all data behind it. Is there any code I can use to "lock" this UserForm? So people cannot move it? Thank yoooou ! |
Blocking Access to Sheet
Hi,
This is some code I kept written by Ivan F Moala that disable the option to move a userform Option Explicit Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As Long, _ ByVal bRevert As Long) As Long Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, _ ByVal nPosition As Long, ByVal wFlags As Long) As Long Private Declare Function FindWindowA Lib "user32" (ByVal lpClassName As String, _ ByVal lpWindowName As String) As Long Private Const MF_BYPOSITION As Long = &H400 Private Sub UserForm_Initialize() Dim lFrmHdl As Long, iCount As Integer lFrmHdl = FindWindowA(vbNullString, Me.Caption) If lFrmHdl < 0 Then For iCount = 0 To 1 RemoveMenu GetSystemMenu(lFrmHdl, False), 0, MF_BYPOSITION Next iCount End If End Sub Mike "Eddie_SP" wrote: Hi Community ! I have in my initial UserForm the following code to take all the screen: Me.Height = Application.Height Me.Width = Application.Width BUT, I've realized that users can move this UF and change the sheets with all data behind it. Is there any code I can use to "lock" this UserForm? So people cannot move it? Thank yoooou ! |
Blocking Access to Sheet
you could try
Application.Visible = False remember to set it back to visible when the form closes though If the userform is shown modal, then they can't access any sheets "Eddie_SP" wrote: Hi Community ! I have in my initial UserForm the following code to take all the screen: Me.Height = Application.Height Me.Width = Application.Width BUT, I've realized that users can move this UF and change the sheets with all data behind it. Is there any code I can use to "lock" this UserForm? So people cannot move it? Thank yoooou ! |
All times are GMT +1. The time now is 08:50 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com