Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 373
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 284
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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
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
Userform hack minimize maximize Antoine Excel Programming 0 March 2nd 07 05:25 PM
Create UserForm programmatically Ber Excel Programming 5 September 11th 05 11:20 AM
Maximize Userform Swift2003 Excel Programming 1 April 1st 04 06:47 PM
How to get Maximize and Minimize buttons on Userform TBA[_2_] Excel Programming 1 September 9th 03 08:13 PM
Minimize workwook and then maximize UserForm Fede Querio Excel Programming 0 July 28th 03 06:44 PM


All times are GMT +1. The time now is 06:31 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"