While working in practice and as a freelance consultant, one of my first questions in response to a user's problem, typically "why are all my references missing and showing up red", would be which project (now WorkSet) are you in (perhaps more precise terminology would be "what is your active WorkSet?"). This might lead to an explanation of how to confirm the name of the active project/WorkSet which can be time consuming and is not certain to provide the correct result.
While we have the facility via variable MS_FULLPATHINTITLEBAR to display the full path to the active file in Title Bar, no other information can be displayed.
This led to me writing a VBA that displayed the active project in the application Title Bar. I have now tidied this up and updated it for CONNECT Edition, to accommodate an increasingly populated Title Bar I have amended the text string to abbreviate the file path to drive and containing folder:
The original intent was simply to add the active project name to the Title Bar, however the Application.Caption command entirely replaces the Title Bar content, so as well as adding new content the existing content (filename, dimension, format, application) also has be be reconstructed. Sections 1 to 6 of the macro gather most of this information via the appropriate commands and set up the additional content. Section 7 creates additional variables that create the text strings used in section 8 to populate the Title Bar.
Download and unzip the macro (updated July 2021), then copy into your Custom Configuration ...\Organization\Macros\ folder.
Open your standards.cfg and add the lines:
MS_VBAAUTOLOADPROJECTS > Bentley_TitleBarContent_AutoRun_CE_2021MS_VBANEWPROJECTDIRECTORY = $(_USTN_ORGANIZATION)Macros/ MS_VBASEARCHDIRECTORIES < $(_USTN_ORGANIZATION)Macros/ MS_VBA_OPEN_IN_MEMORY = all
Note that the fourth line "MS_VBA_OPEN_IN_MEMORY = ALL" opens VBAs in memory to avoid too many processes opening a single VBA file (which Windows does not like) and hence as read only. To edit the VBA you will need to define "MS_VBA_OPEN_IN_MEMORY = NONE' for read/write access or to READONLY for read/edit access. This can be added to an admin user's personal.ucf.
The information specified by the final section 8 of the macro will replace our default Title Bar content as shown above.
To modify the displayed content open the VBA Editor, then the 'CustomisedContent' module:
Sections 1 to 7 set up the content that will be displayed in the Title Bar. These should not be edited
Scroll down to section 8, and note the comment at the head of the section and that the first line is currently enabled. The subsequent four lines are alternative constructions that use different combinations of the available variables and text strings. To use one of these comment out the first line with an ' then remove the ' from the start of the line that you wish to use. Press F5 or click the run icon to see the result. Save the file once satisfied (see the note above re MS_VBA_OPEN_IN_MEMORY if you cannot save the file. If the file is controlled by your system/CAD/BIM administrator you will need to discuss changes with them). Note that comments are displayed in green.
' 8. constructs title bar caption string, alternative example strings are given below, uncomment only one of these:' Application.Caption = fileName + " [" + modelDimension + spacerHyphenText + dgnFormat + " " + fileFormat + dgnRead + "]" + spacerPipeText + workSpaceText + workSpaceName + spacerPipeText + workSetText + workSetName + spacerPipeText + productNameApplication.Caption = fileDevice + shortPathText + shortFilePath + backslashText + fileName + " [" + modelDimension + spacerHyphenText + dgnFormat + " " + fileFormat + dgnRead + "]" + " " + workSpaceName + " | " + workSetName + spacerPipeText + productName ' Application.Caption = fileName + " [" + modelDimension + spacerHyphenText + dgnFormat + " " + fileFormat + dgnRead + "]" + spacerPipeText + workSpaceText + workSpaceName + spacerPipeText + workSetText + workSetName + spacerPipeText + productName + spacerPipeText + userName' Application.Caption = workSpaceText + workSpaceName + spacerPipeText + workSetText + workSetName + spacerPipeText + fileName + " [" + modelDimension + spacerHyphenText + dgnFormat + " " + fileFormat + dgnRead + "]" + " " + productName + spacerPipeText + userName' Application.Caption = filePath + backslashText + fileName + " [" + modelDimension + spacerHyphenText + dgnFormat + " " + fileFormat + dgnRead + "]" + " " + workSpaceName + " | " + workSetName + spacerPipeText + productName + spacerPipeText + userName' Application.Caption = filePath + backslashText + fileName + " [" + modelDimension + spacerHyphenText + dgnFormat + " " + fileFormat + dgnRead + "]" + spacerPipeText + workSpaceText + workSpaceName + spacerPipeText + workSetText + workSetName + spacerPipeText + productName + spacerPipeText + userName
Each line constructs a text string that will be displayed in the Title Bar using a combination of variables and plain text. The syntax is
Application.Caption = VARIABLE + VARIABLE + "some text" + VARIABLE
The available variables are:
Replacement of existing:
Additional content:
Text blocks to insert separators:
Additional text can be inserted using the syntax above, i.e. + "some text". Anything within the quotation marks will be treated as text including spaces and most special characters.
Additional variables could be created to harvest other information from the active file or configuration following the examples contained in this macro.