Excel VBA Workbook object is the one of the most frequently used object while automating any task with VBA. We refer different Workbooks in Excel and perform various operation on Excel Workbooks. We have different Properties, Methods to deal with Excel Workbook Object. Here you can find a brief explanation about each on most useful Properties and Methods while automation any tasks.
Our objective of building this Excel VBA Explorer is to provide suitable examples on most frequently used methods and properties of Workbook object. So that you can quickly find the solution, syntax whenever you required it.
Workbook Object
We can refer any Excel Workbook using Workbook Object. Workbook is the member of the Workbooks Collection.
'Refers first workbook in the opened Workbooks Set Wb=Workbooks(1) 'Refers the currently Active Workbook Set Wb=ActiveWorkbook 'Refers the workbook where the Visual Basic code is running Set Wb=ThisWorkbook
Methods
Workbook methods helps us to perform different actions with Excel Workbooks. For example, we can Activate a Workbook and Delete a Workbook or Move Workbook. And also we can Protect and UnProtect Workbooks.
Excel VBA Workbook Object Methods
- Activate: To Activate a Workbook
- Close: To Close a Workbook
- Protect: To Protect a Workbook
- ProtectSharing: To ProtectSharing a Workbook
- RefreshAll: To RefreshAll a Workbook
- RejectAllChanges: To RejectAllChanges a Workbook
- RemoveUser: To RemoveUser in a Workbook
- RunAutoMacros: To RunAutoMacros in a Workbook
- Save: To Save a Workbook
- SaveAs: To SaveAs a Workbook
- SaveCopyAs: To SaveCopyAs a Workbook
- SendMail: To SendMail a Workbook
- UnProtect: To UnProtect a Workbook
- UnProtectSharing: To UnProtectSharing a Workbook
Properties
Properties of Workbook object will helps us to deal with various properties of Excel Workbooks. For example, we can change the Workbook tab color, we can change the name(rename) of the Workbook, etc.
More Explanation and Examples on Properties of Workbook Object will be available soon.
Wonderful site.. I have benefited a lot from this.
Please update the properties section aswell.
Hi Latha, We are glad to know that you have benefited form our blog. And sure, we will try our best to provide as many example codes as possible.
Thanks-PNRao!