Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programmatically maximize a userform
I am creating a UserForm in excel but there is no way to automaticaly
maximize the form, I have created a function that resizes form to the area used and added a maximize button but client wants it to be maximized when opening form. Can this be done? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programmatically maximize a userform
Private Sub Userform_Initialize()
me.width=application.width me.height=application.height End sub "Gussie" wrote in message ... I am creating a UserForm in excel but there is no way to automaticaly maximize the form, I have created a function that resizes form to the area used and added a maximize button but client wants it to be maximized when opening form. Can this be done? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programmatically maximize a userform
I tried that but it does not give me the entire area, it returns just the
active spreadsheet area. I downloaded the FormFun.xls but it just shows how to add the maximize/minimize buttons. I usually work with Access and I use a cmd.Maximize (or something like that) Thanks! "Zone" wrote: Private Sub Userform_Initialize() me.width=application.width me.height=application.height End sub "Gussie" wrote in message ... I am creating a UserForm in excel but there is no way to automaticaly maximize the form, I have created a function that resizes form to the area used and added a maximize button but client wants it to be maximized when opening form. Can this be done? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programmatically maximize a userform
Option Explicit
Private Declare Function FindWindow _ Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, _ ByVal lpWindowName As String) As Long Private Declare Function ShowWindow _ Lib "user32" (ByVal hWnd As Long, _ ByVal nCmdShow As Long) As Long Function GetFormHwnd(strCaption As String) As Long If Val(Application.Version) = 9 Then GetFormHwnd = FindWindow("ThunderDFrame", strCaption) Else GetFormHwnd = FindWindow("ThunderXFrame", strCaption) End If End Function Private Sub UserForm_Initialize() ShowWindow GetFormHwnd(Me.Caption), 3 End Sub RBS "Gussie" wrote in message ... I am creating a UserForm in excel but there is no way to automaticaly maximize the form, I have created a function that resizes form to the area used and added a maximize button but client wants it to be maximized when opening form. Can this be done? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programmatically maximize a userform
This might do the trick, assuming none of the PCs are Win98 or earlier.
___________________________________ Private Sub UserForm_Initialize() Set objWMIService = GetObject("winmgmts:\\.\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor") For Each objItem In colItems intHorizontal = objItem.ScreenWidth intVertical = objItem.ScreenHeight Next Me.Width = intHorizontal Me.Height = intVertical End Sub __________________________________ Steve "Gussie" wrote in message ... I tried that but it does not give me the entire area, it returns just the active spreadsheet area. I downloaded the FormFun.xls but it just shows how to add the maximize/minimize buttons. I usually work with Access and I use a cmd.Maximize (or something like that) Thanks! "Zone" wrote: Private Sub Userform_Initialize() me.width=application.width me.height=application.height End sub "Gussie" wrote in message ... I am creating a UserForm in excel but there is no way to automaticaly maximize the form, I have created a function that resizes form to the area used and added a maximize button but client wants it to be maximized when opening form. Can this be done? |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programmatically maximize a userform
Thank you very much!
"RB Smissaert" wrote: Option Explicit Private Declare Function FindWindow _ Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, _ ByVal lpWindowName As String) As Long Private Declare Function ShowWindow _ Lib "user32" (ByVal hWnd As Long, _ ByVal nCmdShow As Long) As Long Function GetFormHwnd(strCaption As String) As Long If Val(Application.Version) = 9 Then GetFormHwnd = FindWindow("ThunderDFrame", strCaption) Else GetFormHwnd = FindWindow("ThunderXFrame", strCaption) End If End Function Private Sub UserForm_Initialize() ShowWindow GetFormHwnd(Me.Caption), 3 End Sub RBS "Gussie" wrote in message ... I am creating a UserForm in excel but there is no way to automaticaly maximize the form, I have created a function that resizes form to the area used and added a maximize button but client wants it to be maximized when opening form. Can this be done? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Userform hack minimize maximize | Excel Programming | |||
Create UserForm programmatically | Excel Programming | |||
Maximize Userform | Excel Programming | |||
How to get Maximize and Minimize buttons on Userform | Excel Programming | |||
Minimize workwook and then maximize UserForm | Excel Programming |