|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IVbaApplication
Provides access to members that modify the VBA projects in this application.
The Application object implements the IVbaApplication interface.
The IVbaApplication interface allows you to programmatically insert, remove, and run VBA code without actually opening the Visual Basic Editor. This interface has methods to create a new module, insert code into a specific module, remove a module, and run and macro.
Method Summary | |
---|---|
void |
createCodeModule(String docName,
String moduleName)
Creates a code module in the specified VBA project. |
void |
insertCode(String docName,
String moduleName,
String codeText)
Inserts code into the specified module. |
void |
removeCodeModule(String docName,
String moduleName)
Removes a code module from the specified VBA project. |
Object |
runVBAMacro(String docName,
String moduleName,
String macroName,
Object arguments)
Runs the specified VBA macro. |
Method Detail |
---|
Object runVBAMacro(String docName, String moduleName, String macroName, Object arguments) throws IOException, AutomationException
docName specifes the name of the VBA project that contains the macro you want to run.
moduleName specifes the name of the module that contains the macro you want to run.
MacroName specifies the name of the macro you want to run.
arguments is a Variant array that represents the arguments that you want to pass into this macro.
If the macro is in the current document, docName will be "Project".
If the macro is in the Normal template, docName will be "Normal".
If the macro is in a template, docName will be "TemplateProject".
If you want to pass arguments into this macro you are running, first add the arguments to an array and then use that array for arguments parameter of the RunVBAMacro method.
docName
- The docName (in)moduleName
- The moduleName (in)macroName
- The macroName (in)arguments
- A Variant (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.void createCodeModule(String docName, String moduleName) throws IOException, AutomationException
docName specifes the name of the VBA project in which you want to create the module.
moduleName specifes the name of the module that you want to create.
If you want to create the module in the current document, docName will be "Project".
If you want to create the module in the Normal template, docName will be "Normal".
If you want to create the module in a template, docName will be "TemplateProject".
docName
- The docName (in)moduleName
- The moduleName (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.void removeCodeModule(String docName, String moduleName) throws IOException, AutomationException
docName specifes the name of the VBA project from which you want to remove the module.
moduleName specifes the name of the module that you want to remove.
If you want to remove a module from the current document, docName will be "Project".
If you want to remove a module from the Normal template, docName will be "Normal".
If you want to remove a module from a template, docName will be "TemplateProject".
docName
- The docName (in)moduleName
- The moduleName (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.void insertCode(String docName, String moduleName, String codeText) throws IOException, AutomationException
docName specifes the name of the VBA project that contains the module in which you want to insert code.
moduleName specifes the name of the module in which you want to insert code. This module must already exist in the VBA project.
codeText is a string that represents all the code for the macro.
If you want to insert code into a module in the current document, docName will be "Project".
If you want to insert code into a module in the Normal template, docName will be "Normal".
If you want to insert code into a module in a template, docName will be "TemplateProject".
The string for codeText must include all the text for the macro code including the sub procedure declaration and end sub.
docName
- The docName (in)moduleName
- The moduleName (in)codeText
- The codeText (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |