Click to See Complete Forum and Search --> : [RESOLVED] Maximized Forms
mazda28
Mar 17th, 2006, 09:08 AM
How can you make a form maximized in vba. the other vb languages give you a property but vba doesn't, does anyone have code for this. cheers.
Kanbei
Mar 17th, 2006, 09:16 AM
WindowState property is the one you're looking for.
Value 0 - Normal
Value 1 - Minimized
Value 2 - Maximized
Hack
Mar 17th, 2006, 09:18 AM
VBA question moved to Office Development
mazda28
Mar 17th, 2006, 09:19 AM
I am using VBA not VB6 can you still help plz. In VBA it dont have a Windows State Property
bushmobile
Mar 17th, 2006, 09:21 AM
you can use API:
Private Declare Function ShowWindow Lib "user32" ( _
ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Const SW_MAXIMIZE = 3
Private Sub UserForm_Click()
ShowWindow FindWindow(vbNullString, Me.Caption), SW_MAXIMIZE
End Sub
Unfortunately that goes over the taskbar as well :ehh: (well for me anyway)
zaza
Mar 17th, 2006, 09:22 AM
That's because in VBA Userforms are more like dialog boxes than actual windows. If you want to maximize it, you need to set the width and height properties to the size of the screen, or use the API.
zaza
mazda28
Mar 17th, 2006, 09:40 AM
I tried the code bush mobile but it didn't maximize the form. i want it so you cannot move the form around with a maximized screen
RobDog888
Mar 17th, 2006, 09:47 AM
Showwindow will not work as the controlbox doesnot have the maximize option. Basically its disabled. You need to use the SetWindowPos API and adjust the forms properties so its fullscreen. The otehr part is using APIs to get the screen size as there is no screen object in vba like there is in vb6.
salvelinus
Mar 17th, 2006, 10:44 AM
What about DoCmd.Maximize in the form Open event?
RobDog888
Mar 17th, 2006, 10:52 AM
No can DoCmd in Excel. If hes using Access then yes. ;)
salvelinus
Mar 17th, 2006, 11:02 AM
Ah. Didn't know that, never used Excel forms.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.