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

protect formulas in excel 2007xlsm file downloadexcel macro while loopwhat is sas sqlhow to insert row in excel shortcut keyexcel autofilter vbaexcel formulas matchkpi dashboard excel templatesvba message boxexcel auto adjust row heightsql pivot tutorialdeclare variables vbahow to learn vlookupmacro security in excel 2007project status dashboard pptexcel task templateexcel vba operatorsexcel how to sort alphabeticallyuse of vlookup in excel 2007how to run a macro in excelproject costing sheetexcel exercises for beginnersexcel mysql connectormacros on excelexcel macro if multiple conditionsvisual basic excel 2007 tutorial pdflock excel file for editingprotect workbook in excelvba wordexcel vba change cell color based on valueconvert excel sheet to xmlappend excel filessql and sasvba rename filevbokonly examplevba pivottablehow to remove macros from excelnested if and statements excelexcel vba object modelexcel conditional statementvba array declarationms access vba codevba stepaverageif excel 2010using vba in excel 2007hide a column in excelexcel formulas for namesmsg vbaexcel merge macrovba progress bar exceliserror and vlookupcreate dashboards in excelremove hyperlinks in excelsas find duplicatesisblank vbaexcel datevalue functionwhat is vlookup formula in excelsql query interview questions for fresherspivot table in excel 2010 with examplehighlighting duplicates in excel 2010checkboxes in excelexcel duplicate rowdeclaring public variables in vbams access vba export query to excelformat vba codeexcel vba programming tutorialsql query excel spreadsheetinstr function vbadraw charts in excelmicrosoft excel chart tutorialiserror excel 2010how to unhide sheets in excelvlookup index number