Programming with Reflection

image\rwnprg32.gif ExportVBAProjectItem method


Syntax object.ExportVBAProjectItem ItemName, [DirName], [Options]



Exports a Visual Basic project item to the specified location. You can export code modules, forms, or classes.

For example, the following statement exports the default Reflection macros module (NewMacros) to the specified file location, overwriting any existing file in that location:

Session.ExportVBAProjectItem "NewMacros", "C:\ProjectFiles", rcOverwrite


ItemName Argument type: String
Specifies the name of a VBA code module, form, or class.

DirName Argument Type: String
Specifies a folder location for the exported file. If the specified folder doesn't exist, it is created. If this argument is omitted, the project item is saved to the currently specified user data directory. (By default this is a Reflection folder located in the "My Documents" folder.)

Options Argument Type: Enumeration
Specifies what to do if the file exists. The possible values are:

rcCancel (Default) Generates an error if the file already exists.

rcAskUser Prompts the user to either cancel or overwrite the file.

rcOverwrite Overwrites the existing file.

rcRename Renames the existing file with a new, unique file name and saves the project using the specified ItemName.


image\jump.gif Keyword Index

image\popup.gif Related Topics

image\popup.gif Reflection products that use this command