Total Visual SourceBook

Total Visual SourceBook CD and Printed Manual

Microsoft Access/ Office 2016, 2013, 2010, and 2007 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office 2007 and VB6

Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!

Separate version for Access/Office 2003, 2002, and 2000.

Separate version for:
Access 97/95


View all FMS products for Microsoft AccessAll Our Microsoft Access Products

SourceBook Info:

Why SourceBook?

 

"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP

 

 

 

Microsoft Access, Office/VBA, VB6 Modules royalty-free source code libraryMicrosoft Access Modules royalty-free source code libraryMicrosoft Access VBA and VB6 Module Library Free trial of Total Visual SourceBook for Microsoft Access, Office, VB6 and VBA

Module: Macros in Category Microsoft Access : Macros and Modules from Total Visual SourceBook

Retrieving Microsoft Access macro names and running them in Access VBA.

Procedure List

Procedure Name

Type

Description

(Declarations) Declarations Declarations and private variables for the modMacros module
MacroNamesToArray Procedure Loads an array with the names of all the macros in the current database
MacroNamesToString Procedure Populate a string with the names of all the macros in the current database
RunAMacro Procedure Run a macro and trap for errors. If an error occurs while running the macro, a value of False is returned. If no errors occur, a value of True is returned. For more advanced use, you use the full syntax of the DoCmd RunMacro command: Syntax: DoCmd RunMacro MacroName, RepeatCount, RepeatExpression where: RepeatCount - the number of times to run the macro RepeatExpression - when this becomes false, the macro stops repeating

Example Code for Using Module: Macros

' Example of modMacros
'
' To try this example, do the following:
' 1. Create a new form in your copy of Sample.mdb (in the Total Visual SourceBook sample directory).
' 2. Create a command button 'cmdTest'
' 3. Paste this code into the form's module

Private Sub Form_Open(Cancel As Integer)
  cmdTest.Caption = "Test Access macro functions"
End Sub

Private Sub cmdTest_Click()
  Dim astrNames() As String
  Dim strNames As String
  Dim intCount As Integer
  Dim intCounter As Integer

  ' Example of MacroNamesToArray
  intCount = MacroNamesToArray(astrNames)
  Debug.Print "Macro Names:"
  For intCounter = 0 To intCount - 1
    Debug.Print intCounter & ": " & astrNames(intCounter)
  Next intCounter

  ' Example of MacroNamesToString
  intCount = MacroNamesToString(strNames, ";")
  Debug.Print "Macro Names: " & strNames

  ' Example of RunAMacro
  RunAMacro "Macro1"

End Sub

Microsoft Access Module LibraryOverview of Total Visual SourceBook

The source code in Total Visual SourceBook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Additional Resources