libVb (Macro Code Functions)

This module contains functions to deal with macro code in excel documents.

Summary
This module contains functions to deal with macro code in excel documents.
Removes the VBA module named name from this workbook and tries to import it from the file specified by filepath.
Exports the VBA module named name to the file given by filepath.
Removes the complete VBA code from an excel document Note that for this work the macro code needs to have access to the vbComponents.

Functions

reimportVBModule(name As String, filepath As String)

Public Sub reimportVBModule(name As String,
filepath As String)

Removes the VBA module named name from this workbook and tries to import it from the file specified by filepath.  Use this function, to update VBA modules from outside the excel document.

reimportVBModule "libRanges", ActiveWorkbook.path + "\libRanges.bas"

exportVBModule(name As String, filepath As String)

Public Sub exportVBModule(name As String,
filepath As String)

Exports the VBA module named name to the file given by filepath.

exportVBModule "libRanges", ActiveWorkbook.path + "\libRanges.bas"

removeAllModules()

Public Sub removeAllModules()

Removes the complete VBA code from an excel document Note that for this work the macro code needs to have access to the vbComponents.  This can be granted in Extras->Macros->Security

removeAllMacros
Public Sub reimportVBModule(name As String,
filepath As String)
Removes the VBA module named name from this workbook and tries to import it from the file specified by filepath.
Public Sub exportVBModule(name As String,
filepath As String)
Exports the VBA module named name to the file given by filepath.
Public Sub removeAllModules()
Removes the complete VBA code from an excel document Note that for this work the macro code needs to have access to the vbComponents.