REAL-TIME

VBA Projects

Full Access with Source Code

  • Designed and Developed by PNRao

  • Full Access with VBA Source Code

  • Well Commented Codes Lines

  • Creative and Professional Design

120+ PROFESSIONAL

Project Management Templates

120+ PM Templates Includes:
  • 50+ Excel Templates

  • 50+ PowerPoint Templates

  • 25+ Word Templates

Effortlessly Manage Your Projects

Seamlessly manage your projects with our powerful & multi-purpose templates for project management.

Share Post

In VBA ‘RunAutoMacros’ Workbook method is used to runs the ‘xlRunAutoMacros’ which is attached to the workbook. Where xlRunAutoMacros’ can be one of these: xlAutoActivate or xlAutoDeactivate or xlAutoOpen or xlAutoClose. We can write these macros in the standard module. If auto run macros are available in workbook events then it will fire the auto run macros in the standard module before running in workbook events.

VBA RunAutoMacros Method Excel Workbook Object

Why we need RunAutoMacros Workbook using VBA?

If we want to run macros automatically in certain time we use RunAutoMacros method of Workbook object.

VBA RunAutoMacros Workbook – Syntax

Here is the syntax to RunAutoMacros workbook method using VBA.

Workbooks(“Your Workbook Name”).RunAutoMacros(Which As XlRunAutoMacro)

Where ‘Which’ is the required parameter. ‘Which’ can be one of the below.

NameValueDescription

xlAutoActivate 3 Auto_Activate macros
xlAutoClose 2 Auto_Close macros
xlAutoDeactivate 4 Auto_Deactivate macros
xlAutoOpen 1 Auto_Open macros

In the above syntax we are using ‘RunAutoMacros‘ method of workbook object to run auto macros in the standard module.

VBA RunAutoMacros Workbook: Example 1

Please find the below example, It will show you how to run auto macros in the standard module.
Standard Module:

Private Sub Auto_Open()
    MsgBox "Auto Open Event"
End Sub

Workbook Event:

Private Sub Workbook_Open()
    MsgBox "Workbook Open Event"
End Sub

Explanation: You can write procedures in the standard module and then call those macros in the workbook events instead of writing it in Workbook event. Its use to navigate the code in the standard module while debugging the code.
Note:If we have written both the above macros in the same workbook, while running macro it will fire the AutoRun macro in the standard module first and then it will run workbook event.

VBA RunAutoMacros Workbook – Instructions

Please follow the below step by step instructions to execute the above mentioned VBA macros or codes:

  1. Open an Excel Workbook
  2. Press Alt+F11 to Open VBA Editor
  3. Insert a Module from Insert Menu
  4. Copy the above code for activating a range and Paste in the code window(VBA Editor)
  5. Save the file as macro enabled workbook
  6. Press ‘F5’ to run it or Keep Pressing ‘F8’ to debug the code line by line.
Effortlessly Manage Your Projects and Resources
120+ Professional Project Management Templates!

A Powerful & Multi-purpose Templates for project management. Now seamlessly manage your projects, tasks, meetings, presentations, teams, customers, stakeholders and time. This page describes all the amazing new features and options that come with our premium templates.

Save Up to 85% LIMITED TIME OFFER
Project Management Templates

All-in-One Pack
120+ Project Management Templates

Essential Pack
50+ PM Templates

Excel Pack
50+ Excel PM Templates

PowerPoint Pack
50+ Excel PM Templates

MS Word Pack
25+ Word PM Templates

Ultimate Project
Management Template
Ultimate Resource
Management Template
Project Portfolio
Management Templates
Last Updated: March 2, 2023

One Comment

  1. Barath Kumar March 11, 2020 at 5:07 PM - Reply

    Thanks a lot for this “Run Auto Macros” concept . Finally I completed my project because of this webiste only

Leave A Comment