WindowState Property of Application Object VBA

WindowState Application Property in VBA is used to returns or sets the state of the application window based on XlWindowState. Please find below more information about WindowState.



50+ Project Management Templates Pack
Excel PowerPoint Word

Advanced Project Plan & Portfolio Template
Excel Template

Business Presentations Templates Pack
PowerPoint Slides

20+ Excel Project Management Pack
Excel Templates

20+ PowerPoint Project Management Pack
PowerPoint Templates

10+ MS Word Project Management Pack
Word Templates

VBA WindowState Application Property – Syntax

Here syntax for WindowState Property of application object in VBA.

Application. WindowState

Where WindowState as XlWindowState: It specifies the state of the window. Please find the XlWindowState enumeration values at the end of the chapter. In the above syntax an Application represents object and WindowState is the Property of an Application object.

VBA WindowState Application Property: xlMaximized

Please find the below example for WindowState Property of application object in excel VBA. The below example maximizes the application window.

Sub Window_xlMaximized()
Application.WindowState = xlMaximized
End Sub

VBA WindowState Application Property: xlMinimized

Please find the below example for WindowState Property of application object in excel VBA. The below example minimizes the application window.

Sub Window_xlMinimized()
Application.WindowState = xlMinimized
End Sub

VBA WindowState Application Property: xlNormal

Please find the below example for WindowState Property of application object in excel VBA. The below example sets the application window to normal state.

Sub Window_xlNormal()
Application.WindowState = xlNormal
End Sub

VBA WindowState Application Property – Instructions

Please follow the below steps to execute the VBA code to save the excel file.
Step 1: Open any existing Excel Application.
Step 2: Press Alt+F11 – This will open the VBA Editor.
Step 3: Insert a code module from then insert menu.
Step 4: Copy the above code and paste in the code module which have inserted in the above step.
Step 5: Now press F5 to execute the code.

VBA WindowState Application Property – XlWindowState Enumeration

Please find the below XlWindowState enumeration values and their description in the table. Where XlWindowState represents the state of the window in Excel.

Window State Excel Name Value
Maximized xlMaximized -4137
Minimized xlMinimized -4140
Normal xlNormal -4143

Leave A Comment

Related pages

vb color codesrange in vbarows vbaactivex control excelexcel macro beginnervariant vbaautomatically hide rows in excelhow to change the width of a column in excelauto sort in excel without macrosexcel 2007 unhide all sheetsvlookup with and functionadding charts in excelvba merge excel filesexcel bar of piebuilding a macro in excelsimple if statement in excelcreate checkbox in excel 2010macros basicsdownloadable gantt charttechnical interview questions for freshers with answers pdfhow to unhide all hidden columns in excelvba write to a text filehighlight duplicates in excel 2003vba and macroshlookup tutorialexcel 2007 developer ribbonhow to put columns in alphabetical order in excelmsgbox access vbaexcel formula for greater thanexcel lookup function examplesword vbavb interview questionsmerging sheets in excelexcel macro programmingunprotect password protected excel sheetexcel option explicitactive worksheet vbaworkbook window definitionvba converter packvba show message boxinsert rows excel shortcuthow to use pivot tables in excel 2010vba basics excelhow to protect a worksheet in excel 2007vba array redimxlsm file downloadexcel macro open filecount if functionshortcut key for insert rowexcel vba cell addresshow to start vba in excelhow to add developer tab to the ribbonfilesystemobject file existsexcel macro recorderhow do i insert a row in excelnested ifs in excelhow to remove header in excelfind duplicates excel 2003converter excel to csvmicrosoft excel countifreference excel cell in vbavlookup excel sheet downloadvba guisumif excel 2010 exampleexcel vba leftexcel vba rename fileexcel count rows in rangevariable types vbamicrosoft excel tutorial torrentcode for comboboxexcel macro to delete blank rowsjob costing template excel