In this section we will walk through a programming sample to show how to use Code VBA to speed up coding.
Code VBA functionality is available from the toolbar and its menu.
![]()
Using Alt-key combinations significantly speeds up the use of the coding
tools.
Note: It occurs sometimes that as a result of the way the Code VB toolbar is added to the toolbar area that not all buttons are displayed. If that is the case you can reorganize the toolbar area a bit to have full access.
Description: loop through the files of a folder. If a certain condition is met rename the folder.

Result:

Notes:

Result:

Note:

Result:

Next type in = "dlg*"

Note:
a. select the variable to replace with string using double-click

b. start file selection from Shortcuts (dockable) dialog

c. select the folder

Result:

Alt-CI[enter] inserts the If .. Then block.

Result:

In this example we want only files before a certain date. We don't feel certain which function to use and try to find the correct one.
a. go to tab Search in dockable Shortcuts and Search dialog
Type 'file' and press [Enter]. Listed are all procedures and fragments which have something to do with file. (You could have added the word 'date' which would restict it further to all titles with file and date in it)

b. Double-click on FileDateTime starts the Line of Code Builder with that function selected.
Tab a few times and you will get the variable selection popup listbox opened

c. check how to use this function using [?] (on the dialog - next to [Help])

This opens the VB help on this function. OK, lets use this. Select strFilePath and press [Insert]
d. Finding the procedure to compare dates works the same way.
Notes:
Result:

Let's assume I don't know how to rename files. I again use Search, now with 'rename'

There are two instances found:

I know the file I want to rename is in variable strFilePath. The second argument for name is the new name. I don't yet know how to get that name, but I make a <New Variable> for it:

Next OK on the Variable Builder and [Insert] on the Fragment Builder.
(some empty lines removed to fit the page)
