Q How do I write a macro to attach a reference file?
A
Similar questions crop up now and then on the
Bentley Discussion Groups.
We wrote the example AttachRef to illustrate one approach.
The source code is provided in the VBA module AttachRef.mvba ZIP archive. Copy this file to a VBA folder, such as …
C:\Program Files\Bentley\Workspace\Standards\vba
Then you can use the code as supplied, or open it with the VBA Project Manager to examine the source code. If you want to use it without modification, the MicroStation keyin is …
vba run [AttachRef]modAttachRef.Main <fileName> [, <logical name>> [ , <description> ]]
The logical name and description are optional. The file should exist in one of the folders specified
by your MS_RFDIR configuration variable. This code always attempts to attach the file coincidentally.