|
-
Mar 17th, 2006, 10:08 AM
#1
Thread Starter
Junior Member
[RESOLVED] Maximized Forms
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.
-
Mar 17th, 2006, 10:16 AM
#2
Hyperactive Member
Re: Maximized Forms
WindowState property is the one you're looking for.
Value 0 - Normal
Value 1 - Minimized
Value 2 - Maximized
-
Mar 17th, 2006, 10:18 AM
#3
Re: Maximized Forms
VBA question moved to Office Development
-
Mar 17th, 2006, 10:19 AM
#4
Thread Starter
Junior Member
Re: Maximized Forms
I am using VBA not VB6 can you still help plz. In VBA it dont have a Windows State Property
-
Mar 17th, 2006, 10:21 AM
#5
Re: Maximized Forms
you can use API:
VB Code:
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 (well for me anyway)
-
Mar 17th, 2006, 10:22 AM
#6
Re: Maximized Forms
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
-
Mar 17th, 2006, 10:40 AM
#7
Thread Starter
Junior Member
Re: Maximized Forms
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
-
Mar 17th, 2006, 10:47 AM
#8
Re: Maximized Forms
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.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 17th, 2006, 11:44 AM
#9
Frenzied Member
Re: Maximized Forms
What about DoCmd.Maximize in the form Open event?
Tengo mas preguntas que contestas
-
Mar 17th, 2006, 11:52 AM
#10
Re: Maximized Forms
No can DoCmd in Excel. If hes using Access then yes.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 17th, 2006, 12:02 PM
#11
Frenzied Member
Re: Maximized Forms
Ah. Didn't know that, never used Excel forms.
Tengo mas preguntas que contestas
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|