I have an Excel app for which I would like to specify the application window size when the screen resolution is greater than 1280 wide. Setting up the window is the easy part (see code below), but, I can't seem to figure out if it is possible to disable resizing of the window afterwards, whether it be through dragging the borders or minimize/maximize (I am talking about the application and not the workbook itself).
This is a 'dictator' application which uses a worksheet as the interface and not a form, so I cannot set a border property.
I have seen mention of an Api WM_SIZE message function but I am not sure if this can be utilized in VBA.
Here is the code that sets up the applications window size and center's it on the desktop:
'WHEN SM_CXSCREEN IS > 1280, otherwise use separate zoom function
hwnd = FindWindow("XLMAIN", Application.Caption)
Call SetWindowPos(hwnd, HWND_TOPMOST, (GetSystemMetrics(SM_CXSCREEN) - 1250) / 2, (GetSystemMetrics(SM_CYSCREEN) - 760) / 2, 1250, 760, 0)
Thx,
Dennis
This is a 'dictator' application which uses a worksheet as the interface and not a form, so I cannot set a border property.
I have seen mention of an Api WM_SIZE message function but I am not sure if this can be utilized in VBA.
Here is the code that sets up the applications window size and center's it on the desktop:
'WHEN SM_CXSCREEN IS > 1280, otherwise use separate zoom function
hwnd = FindWindow("XLMAIN", Application.Caption)
Call SetWindowPos(hwnd, HWND_TOPMOST, (GetSystemMetrics(SM_CXSCREEN) - 1250) / 2, (GetSystemMetrics(SM_CYSCREEN) - 760) / 2, 1250, 760, 0)
Thx,
Dennis