gkuenzli / vbaDeveloper

Tools for development and version control of vba code
3 stars 0 forks source link

Configure vbaDeveloper at project level #4

Open gkuenzli opened 7 years ago

gkuenzli commented 7 years ago

It would be nice to have some mechanism allowing to store a vbaDeveloper configuration, hence some attributes, in every VBA project. This might allow for instance to customize the import/export directory and specify some modules to ignore.

gkuenzli commented 7 years ago

Solution proposed

Let a VBA project include a module called VbaDeveloperConfig specially dedicated to the configuration of VbaDeveloper. In order to avoid any conflict with the code of the hosting project, the configuration shall be written with comment lines exclusively.

The syntax for defining the value of an attribute in the configuration module is:

' <attribute> = <value>

If <value> is a string, quotation marks may be used to specify the data.

Attributes

Source folder

Allows to define the folder used for export/import operations. The specified path is relative to the path of the project. The path may include the name or file name of the project.

Attribute name: RelativeSourcePath Value type: String

Value parameters

Project name: %ProjectName% The name of project as defined in the VBE.

Project file name: %FileName% The file name (including extension) of the document hosting the VBProject.

Default

' RelativeSourcePath = src\%FileName%

Ignored files

Some files (hence some VBComponents) may be ignored by the export/import operations. Create one command line per ignored file. As a value, specify the file name (including extension) that the ignored module would have in the exported directory. Do not include path.

Attribute name: Ignore Value type: String

Default

Nothing is ignored by default.

Example

' Do not handle Module1, it contains a recorded macro
' Ignore = Module1.bas

' Forget about UserForm1, this is for internal testing only
' Ignore = UserForm1.frm

Import after open

Define the EventListner behaviour. Set if code must be imported right after project is opened.

Attribute name: ImportAfterOpen Value type: Boolean

Default

' ImportAfterOpen = True

Format before save

Define the EventListner behaviour. Set if code must be formatted before the project is saved.

Attribute name: FormatBeforeSave Value type: Boolean

Default

' FormatBeforeSave = True

Export after save

Define the EventListner behaviour. Set if code must be exported after the project has been successfully saved.

Attribute name: ExportAfterSave Value type: Boolean

Default

' ExportAfterSave = True