Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default 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
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
how to save a desired window size but hv window comeup fullsz by d smjm1982 Excel Discussion (Misc queries) 1 February 15th 08 11:10 AM
How to Determine if Application Window Still Active Edwin Kelly Excel Discussion (Misc queries) 3 June 26th 07 05:42 PM
How do I open a new window for each excel application? Kris New Users to Excel 2 February 21st 06 09:59 PM
How to set Excel to open a new window for each application Luke Excel Discussion (Misc queries) 1 September 28th 05 11:50 PM
How do I set up Excel to open a new instance/application window w. DK9144 Excel Discussion (Misc queries) 1 February 21st 05 04:34 PM


All times are GMT +1. The time now is 07:26 AM.

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"