Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Locking the Application Window size
Hi there,
I have a question regarding the window size. I'd like to define the application window size which I've done by: Application.WindowState = xlNormal Application.Left = 0 Application.Top = 0 Application.Width = 770 Application.Height = 484 ActiveWindow.WindowState = xlMaximized ActiveWorkbook.Protect , True , True Now I want to lock application window size and prevent users to change it. Only minimizing and restoring to defined size would be possible. It's possible to lock the workbook window size but not the application window. The command: Application.Protect , True, True simply does not exist. There must be some other way to lock application window size. Any help aapreciated. Thank you Dusan |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Locking the Application Window size
You need to do this with API calls:
Private Const MF_BYPOSITION As Long = &H400 Private Declare Function GetSystemMenu Lib "user32" _ (ByVal hWnd As Long, ByVal bRevert As Long) As Long Private Declare Function DeleteMenu 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 Sub DisableSelectedSystemMenuItems() Dim lHandle As Long, lCount As Long On Error Resume Next lHandle = FindWindowA(vbNullString, Application.Caption) If lHandle < 0 Then DeleteMenu GetSystemMenu(lHandle, False), 1, MF_BYPOSITION DeleteMenu GetSystemMenu(lHandle, False), 1, MF_BYPOSITION DeleteMenu GetSystemMenu(lHandle, False), 2, MF_BYPOSITION End If End Sub Private Sub ReenableSystemMenu() Dim lHandle As Long On Error Resume Next lHandle = FindWindowA(vbNullString, Application.Caption) GetSystemMenu lHandle, True End Sub -- Vasant "Dusan" <a@a wrote in message ... Hi there, I have a question regarding the window size. I'd like to define the application window size which I've done by: Application.WindowState = xlNormal Application.Left = 0 Application.Top = 0 Application.Width = 770 Application.Height = 484 ActiveWindow.WindowState = xlMaximized ActiveWorkbook.Protect , True , True Now I want to lock application window size and prevent users to change it. Only minimizing and restoring to defined size would be possible. It's possible to lock the workbook window size but not the application window. The command: Application.Protect , True, True simply does not exist. There must be some other way to lock application window size. Any help aapreciated. Thank you Dusan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how to save a desired window size but hv window comeup fullsz by d | Excel Discussion (Misc queries) | |||
How to Determine if Application Window Still Active | Excel Discussion (Misc queries) | |||
How do I open a new window for each excel application? | New Users to Excel | |||
How to set Excel to open a new window for each application | Excel Discussion (Misc queries) | |||
How do I set up Excel to open a new instance/application window w. | Excel Discussion (Misc queries) |