com.esri.arcgis.framework
Class IVbaApplicationProxy

java.lang.Object
  extended by com.esri.arcgis.interop.Dispatch
      extended by com.esri.arcgis.framework.IVbaApplicationProxy
All Implemented Interfaces:
IVbaApplication, Externalizable, Serializable

public class IVbaApplicationProxy
extends com.esri.arcgis.interop.Dispatch
implements IVbaApplication, Serializable

Provides access to members that modify the VBA projects in this application.

Remarks

The Application object implements the IVbaApplication interface.

When To Use

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.

Product Availability

Available with ArcGIS Desktop.

See Also:
Serialized Form

Field Summary
 boolean noncastable
           
 
Fields inherited from class com.esri.arcgis.interop.Dispatch
DISPATCH_METHOD, DISPATCH_PROPERTYGET, DISPATCH_PROPERTYPUT, DISPATCH_PROPERTYPUTREF, objRef
 
Constructor Summary
  IVbaApplicationProxy()
           
  IVbaApplicationProxy(Object obj)
           
protected IVbaApplicationProxy(Object obj, String iid)
           
 
Method Summary
 void addListener(String iidStr, Object theListener, Object theSource)
           
 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.
 void removeListener(String iidStr, Object theListener)
           
 Object runVBAMacro(String docName, String moduleName, String macroName, Object arguments)
          Runs the specified VBA macro.
 
Methods inherited from class com.esri.arcgis.interop.Dispatch
bindUsingMoniker, constructVtblPosTable, convertToNative, cookieForListener, createDispatch, createObjrefMonikerDisplayName, equals, getActiveObject, getActiveObject, getDefaultProperty, getDispatchIdOfName, getLastErrorCode, getMtsObjectContext, getObjRef, getPropertyByName, getPropertyByName, getVtblPos, hashCode, initDispatch, invoke, invokeMethodByName, invokeMethodByName, invokeMethodByName, invokePropertyGetByName, invokePropertyPutByName, invokePropertyPutByRefByName, isNativeMode, isObjRef, optimizedVtblInvoke, queryInterface, readExternal, release, setNativeMode, setPropertyByName, toString, vtblInvoke, writeExternal
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

noncastable

public boolean noncastable
Constructor Detail

IVbaApplicationProxy

public IVbaApplicationProxy()

IVbaApplicationProxy

public IVbaApplicationProxy(Object obj)
                     throws IOException
Throws:
IOException

IVbaApplicationProxy

protected IVbaApplicationProxy(Object obj,
                               String iid)
                        throws IOException
Throws:
IOException
Method Detail

addListener

public void addListener(String iidStr,
                        Object theListener,
                        Object theSource)
                 throws IOException
Overrides:
addListener in class com.esri.arcgis.interop.Dispatch
Throws:
IOException

removeListener

public void removeListener(String iidStr,
                           Object theListener)
                    throws IOException
Overrides:
removeListener in class com.esri.arcgis.interop.Dispatch
Throws:
IOException

runVBAMacro

public Object runVBAMacro(String docName,
                          String moduleName,
                          String macroName,
                          Object arguments)
                   throws IOException,
                          AutomationException
Runs the specified VBA macro.

Description

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.

Remarks

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.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
runVBAMacro in interface IVbaApplication
Parameters:
docName - The docName (in)
moduleName - The moduleName (in)
macroName - The macroName (in)
arguments - A Variant (in)
Returns:
A Variant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

createCodeModule

public void createCodeModule(String docName,
                             String moduleName)
                      throws IOException,
                             AutomationException
Creates a code module in the specified VBA project.

Description

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.

Remarks

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".

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
createCodeModule in interface IVbaApplication
Parameters:
docName - The docName (in)
moduleName - The moduleName (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

removeCodeModule

public void removeCodeModule(String docName,
                             String moduleName)
                      throws IOException,
                             AutomationException
Removes a code module from the specified VBA project.

Description

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.

Remarks

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".

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
removeCodeModule in interface IVbaApplication
Parameters:
docName - The docName (in)
moduleName - The moduleName (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

insertCode

public void insertCode(String docName,
                       String moduleName,
                       String codeText)
                throws IOException,
                       AutomationException
Inserts code into the specified module.

Description

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.

Remarks

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.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
insertCode in interface IVbaApplication
Parameters:
docName - The docName (in)
moduleName - The moduleName (in)
codeText - The codeText (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.