
Fragments are pieces of code that occur regularly in programs but which can't be encapsulated in procedures. The image shows a typical example of a fragment (Open Jet Database). It consists of a series of lines you use regularly in your code, but which you would normally not encapsulate in a procedure. Which fragments folders are visible in the tree depends on:
Start this dialog from Toolbar
or using Alt-CN ( Code-vb - Fragme
nt)
Coding using fragment builder consists of selecting the appropriate fragment and moving through the open parameter positions using tab. At each positions a pop-up lets you select an appropriate action: insert an existing or new variable or expression. A selected variable will automatically replace all parameter positions with the same specification (see below). [Insert] adds the fragment to the current position in the code module. The cursor is automatically moved to the position in the fragment marked with <cursor>.

A selected variable will automatically replace all parameter positions with the same specification
If you want a node to appear at multiple nodes in the tree you can use shortcuts. This makes it easier to find the node you require. For example looping throughmultiple files fragment you might look for either under the Files and Folders node and under Loops node.
To create a shortcut:
Note: you can also use Explorer to create shortcuts.
Create a new fragment.
Edit selected fragment.
Delete selected fragment
Inserts the fragment to the current position in the code module. The cursor is automatically moved to the position in the fragment marked with <cursor>. Uses defaults on not specified parameters.
Closes the builder without adding the fragment
Starts this Help topic
| Builders and tools included in Code VBA |
|---|