VBA code to Protect and Unprotect Workbooks

VBA Code Snippets

In a previous VBA Code Snippet, we covered protecting and unprotecting worksheets.  In this post, we will consider protecting and unprotecting workbooks.  The two topics are closely related, so if this post does not provide the information you need, then read that post too. Before getting started, there is an important change in Excel 2013 … Read more

VBA code to create, delete and manage folders

VBA Code Snippets

Creating, deleting and renaming folders is a common requirement when automating processes with VBA.  The code snippets below should be sufficient to complete the most common folder tasks. All the code examples below use the built-in Dir() function and its derivatives.  The File System Object methods are not covered in this post but will be … Read more

Reading document properties with VBA

VBA Code Snippets

In the Windows Explorer it is possible to view a document’s properties.  Right-click on the file and select Properties. There is useful information in here, such as author, creation date, last saved date etc.  The good news is, we can access this information using VBA with  the BuiltinDocumentProperties Property. Not all document properties are populated … Read more

Cell and Range VBA properties and actions

VBA Code Snippets

Manipulating ranges and cells is one of the most common actions in VBA.   You can use the following to either learn from or just to copy and paste into your own code. Referencing ranges & cells from the worksheet ‘Reference range by address Workbooks(“WorkbookName.xlsx”).Worksheets(“SheetName”).Range(“A1:D4”).[Other properties and actions] ‘Reference cells by row and column – Cells(Row,Column) … Read more