Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default 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 !
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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 !

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default 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 !

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
protecting sheet blocking comment creation Amadis Excel Discussion (Misc queries) 3 March 9th 06 11:47 AM
blocking cells confused of nottingham Excel Worksheet Functions 2 August 18th 05 11:59 AM
Blocking VBA Project econcult Excel Programming 4 March 18th 05 06:06 PM
How to overide spell check blocking in protected sheet johnnymo Excel Programming 3 July 15th 04 02:51 PM
Blocking cells Ed Excel Programming 0 February 10th 04 05:57 PM


All times are GMT +1. The time now is 06:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"