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


sql dml and ddlif statements in vbavba excel examplevlookup example 2013excel unprotect sheet password removerexcel vba saveasvba tipshlookup function in excel with exampleexcel vba font colorvba scripting in excelmacros vbavba numberformathow to insert macro in excel 2007checkboxes in excel 2007excel macro pastetechnical interview questions and answers for freshers pdfactivesheet.cellssumif formula in excelwhat is hlookup and vlookupexcel macro countifdelete record vbavba newlinevlookup 2010 tutorialsample vba excel codeselection range vbauseful vba macrosunprotect excel sheet without passwordaverageifsexcel write macrohow do i remove blank rows in excelvlookup example between two sheetscombine sheets in excelexcel insert row formulavlookup alternativevba protect workbookvlookup col_index_numvba for modelersunhide a column in excelcheck box on excelxls vlookuphow to find duplicates in excel and delete themshortcut key to insert comment in excelvlookup in excel 2007how to remove duplicate cells in excel 2010excel vba save as pdfconvert excel columns to rowscba excelcombine multiple spreadsheets into onerca format in wordms access vba codemicrosoft excel 2007 exam questions and answerspivot table chart excelexcel visual basic arraymerge cells in excel 2010delete empty cells in excelpivot table vbamicrosoft excel gantt chart templateconstruction cost estimator excelend xlupexcel macro for dummiesexcel macro write to text filelookup command in excelmerge cells in excel 2013delete vbavb scripts in excelexcel vba range copyexcel find duplicates and deletevba stringexcel check boxexcel vlookup formulavba range clearhow to use iferror function in excelvba import data from another excel fileadvanced vlookup tutorialexcel vba sub functionusing case in vbavba to create pivot table