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.

PREMIUM TEMPLATES LIMITED TIME OFFER

ON SALE80% OFF

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
LIMITED TIME OFFER

Leave A Comment


Related pages


vba callhide excel worksheetproject status dashboard pptvlookup simplehow to unhide rows and columns in exceldelete a row vbaexcel macro to delete blank rowsvba update queryactivex comboboxchoose vbaaccess vba rgb color codeshow to highlight column in excelhow to loop in vbaexcel formulas greater thanpie chart excel templateexcel project management dashboard templateexcel 2010 chart titlepowerpoint swot analysis templatevba close workbookms excel password protectexcel form controls vbahow do i lock excel spreadsheetvisual basic check boxexcel vba rgb color codesvba filter criteriapivot tables tutorialshow to combine duplicate rows in excelexcel 2007 vba macro programminglookup functions in excel 2010sas macro programming for beginnersvba excel formuladml and ddl in sql servercombobox additemhow to protect excel worksheetvisual basic checkboxmacro loop excelexcel vba arrayremove duplicates vbahow to merge cells in excel 2010how to remove duplicates from two columns in excelmacro to unprotect worksheetlast cell excelmsgbox syntaxhidden cells in excelexcel check for blank celldashboard excel examplesmatch function in excelvba merge cellshow to program macros in excelweekly gantt chart excelexcel highlight columnworkbook activatefresher technical interview questionspastespecial in vbadcl in sqlvba connect to sqlvba filter criteriaexcel nested if and statementsmultiple criteria in excelvba sql selectexcel macro select rowinterview questions on vbtrim function in accesshow to develop macros in excelexcel call macropassword protect spreadsheethow to change the width of columns in excelheaders in excelmacro to find duplicates in excelunprotect excel worksheet without passwordenable macro vbasendmail attachment exampleduplicate function in excelvba excel bordersvlookup excel example 2010