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: VB_Application in Category Microsoft Visual Basic 6 : Application Techniques from Total Visual SourceBook

Routines for working with modules and the IDE in VB6.

This includes handling chores such as ensuring that all forms in the application are closed before exiting, and testing the open status of forms in your and other applications.

Procedure List

Procedure Name



(Declarations) Declarations Declarations and private variables for the modVB_Application module
AnyModulesOpen Procedure Determine if any modules are open in the VBE.
CloseAllVBEModules Procedure Close all open modules in VBE.
CloseForms Procedure Close all forms in the application. The calling form is closed last. If you want to close your application without using the 'END' statement, and you have many forms which may or may not be open, it may be difficult to completely close an application. The application does not stop until all forms are unloaded.
CloseVBEWindow Procedure Close the VBE window.
GetOpenModuleCount Procedure Get the number of modules open in the VBE.
IsAppRunningTitled Procedure Check to see if there is an application running with the specified caption. This function finds exact matches only. For example, if you have a copy of Notepad running with no document loaded, you would need to search on the value "Untitled - Notepad", not just "Notepad".
IsCurrentProjectSaved Procedure Determine if the current VBE project is in a saved state.
IsFormLoaded Procedure Test to see whether the default instance of a form is loaded. If the default instance of a form is loaded, it is in the Forms collection. This function tests to see whether a form of the specified name is in the collection.
IsModuleSaved Procedure Determine if the current module is in a saved state in the VBE.
RunningFromIDE Procedure Determine if the program is currently running from the VB6 IDE or from the compiled executable. Requires an app with at least one form

Example Code for Using Module: VB_Application

' Example of modVB_Application
' To try these examples, do the following:
' 1. Create a new form
' 2. Create a command button 'cmdTest'
' 3. Create a command button 'cmdExit'
' 4. Paste all the code from this example to the new form's module.
'    Press the cmdTest and cmdExit buttons to test the procedures.

Private Sub cmdTest_Click()

  ' Example of IsAppRunningTitled
  ' Try running the CALC.EXE application to test this procedure
  If IsAppRunningTitled("Calculator") = True Then
    MsgBox "Calculator is running"
    MsgBox "Calculator is not running"
  End If

  ' Example of IsFormLoaded
  ' To test this function, create a form called "Customers" and test with the form both loaded and unloaded
  If IsFormLoaded("Customers") = True Then
    MsgBox "Customers form is open"
    MsgBox "Customers form is not open"
  End If

  ' Example of RunningFromIDE
  If RunningFromIDE() = True Then
    MsgBox "The app is running from the IDE"
    MsgBox "The app is running from the executable"
  End If

End Sub

Private Sub cmdExit_Click()
  ' Example of CloseForms
  ' Close all forms in the application first, and then close the current form, which causes the application to stop

  CloseForms Me

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