<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communities.bentley.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Automatic Subroutine Loading</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21844/automatic-subroutine-loading</link><description>Bentley View, MicroStation, PowerDraft</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>Automatic Subroutine Loading</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21844/automatic-subroutine-loading</link><pubDate>Thu, 09 Jul 2015 15:00:04 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:630076a2-7e0e-4eb4-b37f-946dd6b5ffba</guid><dc:creator>Maggie Fortescue</dc:creator><comments>https://communities.bentley.com/products/microstation/w/microstation__wiki/21844/automatic-subroutine-loading#comments</comments><description>Current Revision posted to MicroStation Wiki by Maggie Fortescue on 7/9/2015 3:00:04 PM&lt;br /&gt;
&lt;h1&gt;&lt;b&gt;&lt;img style="border-width:0px;" alt=" " src="/cfs-file.ashx/__key/communityserver-components-sitefiles/TSG-Logo.png" width="189" height="60" /&gt;&lt;/b&gt;&lt;/h1&gt;
&lt;table style="width:500px;background-color:#dce5f0;border:#dce5f0 0px solid;" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;span style="font-size:medium;"&gt;&lt;b&gt;Applies To&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Product(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;MicroStation&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Version(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;08.11.09.578&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Environment:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Windows 7 32 bit,Windows 7 64 bit&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Area:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Programming&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Subarea:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;VBA&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Original Author:&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tristan Anderson, Bentley Technical Support Group&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The naming of a subroutine generally does not matter. One exception, however, is the name OnProjectLoad. If a subroutine gets this name, it is automatically started as soon as it is loaded.&lt;br /&gt;This makes it much easier to use when you start MicroStation to load a VBA project because not only does it load, it runs.&lt;br /&gt;Here &amp;nbsp;is a small example:&lt;/p&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Sub  OnProjectLoad ()
    MsgBox &amp;quot;Hello, I was just loaded&amp;quot;
    ActiveWorkspace.AddConfigurationVariable &amp;quot;new_variable&amp;quot;, &amp;quot;testvalue&amp;quot;, True
End Sub&lt;/pre&gt;
&lt;p&gt;If a dialog box is opened, it means that the subroutine has executed. A configuration variable is then set and written in the UCF file.Since this subroutine is executed automatically at startup, the project needs to be loaded automatically. It must be listed in the variables MS_VBAAUTOLOADPROJECTS.&lt;br /&gt;You can also edit the variable or simply make a hook in the project editor as shown circled here:&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-35/7.png"&gt;&lt;img src="/resized-image/__size/940x0/__key/communityserver-wikis-components-files/00-00-00-00-35/7.png" width="325" height="196" alt=" " /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;When you restart MicroStation, the OnProjectLoad routine is automatically loaded and executed, as seen below:&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-35/8.png"&gt;&lt;img src="/resized-image/__size/940x0/__key/communityserver-wikis-components-files/00-00-00-00-35/8.png" width="381" height="270" alt=" " /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Not only does this screenshot show that the routine was executed, but that the subroutine is already running during the startup of MicroStation. The splash-screen of MicroStation is still behind the message box so the subroutine has already been carried out before the MicroStation Manager to select a drawing appears.&lt;br /&gt;It is important at this point to note that although commands can be executed, commands relating to the contents of a drawing lead to errors. It is still possible,however the installation of an event handler that catches the opening of a drawing is required. More information about this can be found in the following article.&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: VBAWindows 7 32 bit, MicroStation, Windows 7 64 bit, Programming, en, 08.11.09.578, SELECTsupport&lt;/div&gt;
</description></item><item><title>Automatic Subroutine Loading</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21844/automatic-subroutine-loading/revision/5</link><pubDate>Wed, 08 Jul 2015 20:34:30 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:630076a2-7e0e-4eb4-b37f-946dd6b5ffba</guid><dc:creator>Maggie Fortescue</dc:creator><comments>https://communities.bentley.com/products/microstation/w/microstation__wiki/21844/automatic-subroutine-loading#comments</comments><description>Revision 5 posted to MicroStation Wiki by Maggie Fortescue on 7/8/2015 8:34:30 PM&lt;br /&gt;
&lt;h1&gt;&lt;b&gt;&lt;img style="border-width:0px;" alt=" " src="/cfs-file.ashx/__key/communityserver-components-sitefiles/TSG-Logo.png" width="189" height="60" /&gt;&lt;/b&gt;&lt;/h1&gt;
&lt;table style="width:500px;background-color:#dce5f0;border:#dce5f0 0px solid;" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;span style="font-size:medium;"&gt;&lt;b&gt;Applies To&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Product(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;MicroStation&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Version(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;08.11.09.578&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Environment:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Windows 7 32 bit,Windows 7 64 bit&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Area:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Programming&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Subarea:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;VBA&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Original Author:&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tristan Anderson, Bentley Technical Support Group&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The naming of a subroutine generally does not matter. One exception, however, is the name OnProjectLoad. If a subroutine gets this name, it is automatically started as soon as it is loaded.&lt;br /&gt;This makes it much easier to use when you start MicroStation to load a VBA project because not only does it load, it runs.&lt;br /&gt;Here &amp;nbsp;is a small example:&lt;/p&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Sub  OnProjectLoad ()
    MsgBox &amp;quot;Hello, I was just loaded&amp;quot;
    ActiveWorkspace.AddConfigurationVariable &amp;quot;new_variable&amp;quot;, &amp;quot;testvalue&amp;quot;, True
End Sub&lt;/pre&gt;
&lt;p&gt;If a dialog box is opened, it means that the subroutine has executed. A configuration variable is then set and written in the UCF file.Since this subroutine is executed automatically at startup, this project needs to be loaded automatically. It must be listed in the variables MS_VBAAUTOLOADPROJECTS.&lt;br /&gt;You can also edit the variable or simply make a hook in the project editor as shown circled here:&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-35/7.png"&gt;&lt;img src="/resized-image/__size/940x0/__key/communityserver-wikis-components-files/00-00-00-00-35/7.png" width="325" height="196" alt=" " /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;When you restart Microstation, the OnProjectLoad routine is automatically loaded and executed, as can be seen below:&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-35/8.png"&gt;&lt;img src="/resized-image/__size/940x0/__key/communityserver-wikis-components-files/00-00-00-00-35/8.png" width="381" height="270" alt=" " /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Not only does this screenshot show that the routine was executed, but that the subroutine is already running during the startup of MicroStation. The splash-screen of MicroStation is still behind the message box so the subroutine has already been carried out before the MicroStation Manager to select a drawing appears.&lt;br /&gt;It is important at this point to note that although commands can be executed, commands relating to the contents of a drawing leads to errors. It is still possible,however the installation of an event handler that catches the opening of a drawing is required. More information about this can be found in the following article.&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: VBAWindows 7 32 bit, MicroStation, Windows 7 64 bit, Programming, en, 08.11.09.578, SELECTsupport&lt;/div&gt;
</description></item><item><title>Automatic Subroutine Loading</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21844/automatic-subroutine-loading/revision/4</link><pubDate>Mon, 08 Jun 2015 17:46:34 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:630076a2-7e0e-4eb4-b37f-946dd6b5ffba</guid><dc:creator>Tristan Anderson</dc:creator><comments>https://communities.bentley.com/products/microstation/w/microstation__wiki/21844/automatic-subroutine-loading#comments</comments><description>Revision 4 posted to MicroStation Wiki by Tristan Anderson on 6/8/2015 5:46:34 PM&lt;br /&gt;
&lt;h1&gt;&lt;b&gt;&lt;img style="border-width:0px;" alt=" " src="/cfs-file.ashx/__key/communityserver-components-sitefiles/TSG-Logo.png" width="189" height="60" /&gt;&lt;/b&gt;&lt;/h1&gt;
&lt;table style="width:500px;background-color:#dce5f0;border:#dce5f0 0px solid;" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;span style="font-size:medium;"&gt;&lt;b&gt;Applies To&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Product(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;MicroStation&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Version(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;08.11.09.578&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Environment:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Windows 7 32 bit,Windows 7 64 bit&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Area:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Programming&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Subarea:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;VBA&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Original Author:&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tristan Anderson, Bentley Technical Support Group&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The naming of a subroutine generally does not matter. One exception, however, is the name OnProjectLoad. If a subroutine gets this name, it is automatically started as soon as it is loaded.&lt;br /&gt;This makes it much easier to use when you start MicroStation to load a VBA project because not only does it load, it runs.&lt;br /&gt;Here this is a small example:&lt;/p&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Sub  OnProjectLoad ()
    MsgBox &amp;quot;Hello, I was just loaded&amp;quot;
    ActiveWorkspace.AddConfigurationVariable &amp;quot;new_variable&amp;quot;, &amp;quot;testvalue&amp;quot;, True
End Sub&lt;/pre&gt;
&lt;p&gt;If a dialog box is opened, it means that the subroutine has executed. A configuration variable is then set and written in the UCF file. For this subroutine is executed automatically at startup, this project needs to be loaded automatically. It must be listed in the variables MS_VBAAUTOLOADPROJECTS.&lt;br /&gt;You can also edit the variable or simply make a hook in the project editor as shown circled here:&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-35/7.png"&gt;&lt;img src="/resized-image/__size/940x0/__key/communityserver-wikis-components-files/00-00-00-00-35/7.png" width="325" height="196" alt=" " /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;When you restart Microstation, the OnProjectLoad routine is automaticall loaded and executed, as can be seen below:&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-35/8.png"&gt;&lt;img src="/resized-image/__size/940x0/__key/communityserver-wikis-components-files/00-00-00-00-35/8.png" width="381" height="270" alt=" " /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Not only does this screenshot show that the routine was executed, but that the subroutine is already running during the startup of Microstation.&amp;nbsp;Behind the message box is still the splashscreen of Microstation, so the subroutine has already been carried out before the Microstation Manager to select a drawing appears.&lt;br /&gt;It is important at this point to note that although commands can be executed, commands relating to the contents of a drawing leads to errors. It is still possible, however, but the installation of an event handler that catches the opening of a drawing is required. More information about this can be found in the following article.&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: VBAWindows 7 32 bit, MicroStation, Windows 7 64 bit, Programming, en, 08.11.09.578, SELECTsupport&lt;/div&gt;
</description></item><item><title>Automatic Subroutine Loading</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21844/automatic-subroutine-loading/revision/3</link><pubDate>Mon, 08 Jun 2015 15:57:45 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:630076a2-7e0e-4eb4-b37f-946dd6b5ffba</guid><dc:creator>Tristan Anderson</dc:creator><comments>https://communities.bentley.com/products/microstation/w/microstation__wiki/21844/automatic-subroutine-loading#comments</comments><description>Revision 3 posted to MicroStation Wiki by Tristan Anderson on 6/8/2015 3:57:45 PM&lt;br /&gt;
&lt;h1&gt;&lt;b&gt;&lt;img style="border-width:0px;" alt=" " src="http://communities.bentley.com/cfs-file.ashx/__key/communityserver-components-sitefiles/TSG-Logo.png" width="189" height="60" /&gt;&lt;/b&gt;&lt;/h1&gt;
&lt;table style="width:500px;background-color:#dce5f0;border:#dce5f0 0px solid;" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;span style="font-size:medium;"&gt;&lt;b&gt;Applies To&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Product(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;MicroStation&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Version(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;08.11.09.578&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Environment:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Windows 7 32 bit,Windows 7 64 bit&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Area:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Programming&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Subarea:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;VBA&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Original Author:&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tristan Anderson, Bentley Technical Support Group&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The naming of a subroutine generally does not matter. One exception, however, is the name OnProjectLoad. If a subroutine gets this name, it is automatically started as soon as it is loaded.&lt;br /&gt;This makes it much easier to use when you start MicroStation to load a VBA project because not only does it load, it runs.&lt;br /&gt;Here this is a small example:&lt;/p&gt;
&lt;blockquote style="margin-right:0px;" dir="ltr"&gt;
&lt;pre style="background:#ffffff;text-transform:none;font-weight:normal;color:#000000;font-style:normal;letter-spacing:normal;line-height:normal;text-indent:0px;"&gt;Sub  OnProjectLoad ()
    &lt;span style="font-weight:bold;color:#7f0055;"&gt;MsgBox&lt;/span&gt; &lt;span style="color:#2a00ff;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#2a00ff;"&gt;Hello, I was just loaded&lt;/span&gt;&lt;span style="color:#2a00ff;"&gt;&amp;quot;&lt;/span&gt;
    ActiveWorkspace.AddConfigurationVariable &lt;span style="color:#2a00ff;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#2a00ff;"&gt;new_variable&lt;/span&gt;&lt;span style="color:#2a00ff;"&gt;&amp;quot;&lt;/span&gt;, &lt;span style="color:#2a00ff;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#2a00ff;"&gt;testvalue&lt;/span&gt;&lt;span style="color:#2a00ff;"&gt;&amp;quot;&lt;/span&gt;, &lt;span style="font-weight:bold;color:#7f0055;"&gt;True&lt;/span&gt;
&lt;span style="font-weight:bold;color:#7f0055;"&gt;End&lt;/span&gt; &lt;span style="font-weight:bold;color:#7f0055;"&gt;Sub&lt;/span&gt;&lt;span style="font-weight:bold;color:#7f0055;"&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;If a dialog box is opened, it means that the subroutine has executed. A configuration variable is then set and written in the UCF file. For this subroutine is executed automatically at startup, this project needs to be loaded automatically. It must be listed in the variables MS_VBAAUTOLOADPROJECTS.&lt;br /&gt;You can also edit the variable or simply make a hook in the project editor as shown circled here:&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-35/7.png"&gt;&lt;img src="/resized-image/__size/940x0/__key/communityserver-wikis-components-files/00-00-00-00-35/7.png" width="325" height="196" alt=" " /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;When you restart Microstation, the OnProjectLoad routine is automaticall loaded and executed, as can be seen below:&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-35/8.png"&gt;&lt;img src="/resized-image/__size/940x0/__key/communityserver-wikis-components-files/00-00-00-00-35/8.png" width="381" height="270" alt=" " /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Not only does this screenshot show that the routine was executed, but that the subroutine is already running during the startup of Microstation.&amp;nbsp;Behind the message box is still the splashscreen of Microstation, so the subroutine has already been carried out before the Microstation Manager to select a drawing appears.&lt;br /&gt;It is important at this point to note that although commands can be executed, commands relating to the contents of a drawing leads to errors. It is still possible, however, but the installation of an event handler that catches the opening of a drawing is required. More information about this can be found in the following article.&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: VBAWindows 7 32 bit, MicroStation, Windows 7 64 bit, Programming, en, 08.11.09.578, SELECTsupport&lt;/div&gt;
</description></item><item><title>Automatic Subroutine Loading</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21844/automatic-subroutine-loading/revision/2</link><pubDate>Mon, 08 Jun 2015 15:47:29 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:630076a2-7e0e-4eb4-b37f-946dd6b5ffba</guid><dc:creator>Tristan Anderson</dc:creator><comments>https://communities.bentley.com/products/microstation/w/microstation__wiki/21844/automatic-subroutine-loading#comments</comments><description>Revision 2 posted to MicroStation Wiki by Tristan Anderson on 6/8/2015 3:47:29 PM&lt;br /&gt;
&lt;h1&gt;&lt;b&gt;&lt;img style="border-width:0px;" alt=" " src="http://communities.bentley.com/cfs-file.ashx/__key/communityserver-components-sitefiles/TSG-Logo.png" width="189" height="60" /&gt;&lt;/b&gt;&lt;/h1&gt;
&lt;table style="width:500px;background-color:#dce5f0;border:#dce5f0 0px solid;" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;span style="font-size:medium;"&gt;&lt;b&gt;Applies To&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Product(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;MicroStation&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Version(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;08.11.09.578&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Environment:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Windows 7 32 bit,Windows 7 64 bit&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Area:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Programming&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Subarea:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;VBA&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Original Author:&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tristan Anderson, Bentley Technical Support Group&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;The naming of a subroutine generally does not matter. One exception, however,&amp;nbsp;is the name&lt;span class="Apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;strong&gt;OnProjectLoad.&amp;nbsp;&lt;/strong&gt;I&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;f a subroutine gets this name, it is automatically started as soon as it is loaded.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;This makes it much easier to use when you start MicroStation to load a VBA project because not only does it load, it runs.&lt;/span&gt;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;Here this is a small example:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;blockquote style="margin-right:0px;" dir="ltr"&gt;
&lt;pre style="background:#ffffff;text-transform:none;font-weight:normal;color:#000000;font-style:normal;letter-spacing:normal;line-height:normal;text-indent:0px;"&gt;Sub  OnProjectLoad ()
    &lt;span style="font-weight:bold;color:#7f0055;"&gt;MsgBox&lt;/span&gt; &lt;span style="color:#2a00ff;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#2a00ff;"&gt;Hello, I was just loaded&lt;/span&gt;&lt;span style="color:#2a00ff;"&gt;&amp;quot;&lt;/span&gt;
    ActiveWorkspace.AddConfigurationVariable &lt;span style="color:#2a00ff;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#2a00ff;"&gt;new_variable&lt;/span&gt;&lt;span style="color:#2a00ff;"&gt;&amp;quot;&lt;/span&gt;, &lt;span style="color:#2a00ff;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#2a00ff;"&gt;testvalue&lt;/span&gt;&lt;span style="color:#2a00ff;"&gt;&amp;quot;&lt;/span&gt;, &lt;span style="font-weight:bold;color:#7f0055;"&gt;True&lt;/span&gt;
&lt;span style="font-weight:bold;color:#7f0055;"&gt;End&lt;/span&gt; &lt;span style="font-weight:bold;color:#7f0055;"&gt;Sub&lt;/span&gt;&lt;span style="font-weight:bold;color:#7f0055;"&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="color:black;font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;If a dialog box is opened, it means that the subroutine has executed. &lt;/span&gt;&lt;span&gt;&lt;span style="color:black;font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;A configuration variable is then set and written in the UCF file. &lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="color:black;font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;For this subroutine is executed automatically at startup, this project needs to be loaded automatically. It must be listed in the variables MS_VBAAUTOLOADPROJECTS. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span&gt;&lt;span style="color:black;font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;You can also edit the variable or simply make a hook in the project editor as shown circled here:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-35/7.png"&gt;&lt;img src="/resized-image/__size/940x0/__key/communityserver-wikis-components-files/00-00-00-00-35/7.png" width="325" height="196" alt=" " /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;When you restart Microstation, the OnProjectLoad routine is automaticall loaded and executed, as can be seen below:&lt;/span&gt;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-35/8.png"&gt;&lt;img src="/resized-image/__size/940x0/__key/communityserver-wikis-components-files/00-00-00-00-35/8.png" width="381" height="270" alt=" " /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;Not only does this screenshot show that the routine was executed, but that the subroutine is already running during the startup of Microstation.&lt;/span&gt;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;Behind the message box is still the splashscreen of Microstation, so the subroutine has already been carried out before the Microstation Manager to select a drawing appears.&lt;/span&gt;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;It is important at this point to note that although commands can be executed, commands relating to the contents of a drawing leads to errors. It is still possible, however, but the installation of an event handler that catches the opening of a drawing is required. More information about this can be found in the following article.&lt;/span&gt;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:#000000;margin:1.5em 0px;letter-spacing:normal;background-color:#ffffff;text-indent:0px;"&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: VBAWindows 7 32 bit, MicroStation, Windows 7 64 bit, Programming, en, 08.11.09.578, SELECTsupport&lt;/div&gt;
</description></item><item><title>Automatic Subroutine Loading</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21844/automatic-subroutine-loading/revision/1</link><pubDate>Mon, 08 Jun 2015 15:44:40 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:630076a2-7e0e-4eb4-b37f-946dd6b5ffba</guid><dc:creator>Tristan Anderson</dc:creator><comments>https://communities.bentley.com/products/microstation/w/microstation__wiki/21844/automatic-subroutine-loading#comments</comments><description>Revision 1 posted to MicroStation Wiki by Tristan Anderson on 6/8/2015 3:44:40 PM&lt;br /&gt;
&lt;h1&gt;&lt;b&gt;&lt;img style="border-left-width:0px;border-right-width:0px;border-bottom-width:0px;border-top-width:0px;" alt=" " src="http://communities.bentley.com/cfs-file.ashx/__key/communityserver-components-sitefiles/TSG-Logo.png" width="189" height="60" /&gt;&lt;/b&gt;&lt;/h1&gt;
&lt;table style="border-top:#dce5f0 0px solid;border-right:#dce5f0 0px solid;width:500px;border-bottom:#dce5f0 0px solid;border-left:#dce5f0 0px solid;background-color:#dce5f0;" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;span style="font-size:medium;"&gt;&lt;b&gt;Applies To&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Product(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;MicroStation&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Version(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;08.11.09.578 &lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Environment:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Windows 7 32 bit,Windows 7 64 bit&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Area:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Programming&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Subarea:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;VBA&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Original Author:&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tristan Anderson, Bentley Technical Support Group&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;font&gt;&lt;font&gt;The naming of a subroutine generally does not matter. One exception, however,&amp;nbsp;is the name&lt;span class="Apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font&gt;&lt;font&gt;&lt;strong&gt;OnProjectLoad.&amp;nbsp;&lt;/strong&gt;I&lt;/font&gt;&lt;/font&gt;&lt;font&gt;&lt;font&gt;f a subroutine gets this name, it is automatically started as soon as it is loaded.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:rgb(0,0,0);margin:1.5em 0px;letter-spacing:normal;background-color:rgb(255,255,255);text-indent:0px;"&gt;&lt;font face="Times New Roman"&gt;This makes it much easier to use when you start MicroStation to load a VBA project because not only does it load, it runs.&lt;/font&gt;&lt;/p&gt;
&lt;p style="white-space:normal;text-transform:none;color:rgb(0,0,0);margin:1.5em 0px;letter-spacing:normal;background-color:rgb(255,255,255);text-indent:0px;"&gt;&lt;font&gt;&lt;font face="Times New Roman"&gt;Here this is a small example:&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;blockquote style="margin-right:0px;" dir="ltr"&gt;&lt;pre style="background:rgb(255,255,255);text-transform:none;font-weight:normal;color:rgb(0,0,0);font-style:normal;letter-spacing:normal;line-height:normal;text-indent:0px;"&gt;Sub  OnProjectLoad ()
    &lt;span style="font-weight:bold;color:rgb(127,0,85);"&gt;MsgBox&lt;/span&gt; &lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;Hello, I was just loaded&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt;
    ActiveWorkspace.AddConfigurationVariable &lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;neue_variable&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt;, &lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;testwert&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt;, &lt;span style="font-weight:bold;color:rgb(127,0,85);"&gt;True&lt;/span&gt;
&lt;span style="font-weight:bold;color:rgb(127,0,85);"&gt;End&lt;/span&gt; &lt;span style="font-weight:bold;color:rgb(127,0,85);"&gt;Sub&lt;/span&gt;&lt;span style="font-weight:bold;color:rgb(127,0,85);"&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;pre style="background:rgb(255,255,255);text-transform:none;font-weight:normal;color:rgb(0,0,0);font-style:normal;letter-spacing:normal;line-height:normal;text-indent:0px;"&gt;&lt;p style="white-space:normal;text-transform:none;color:rgb(0,0,0);margin:1.5em 0px;letter-spacing:normal;background-color:rgb(255,255,255);text-indent:0px;"&gt;&lt;font color="black" face="Times New Roman"&gt;If a dialog box is opened, it means that the subroutine has executed. &lt;/font&gt;&lt;font&gt;&lt;font color="black" face="Times New Roman"&gt;A configuration variable is then set and written in the UCF file. &lt;/font&gt;&lt;/font&gt;&lt;font&gt;&lt;font color="black" face="Times New Roman"&gt;For this subroutine is executed automatically at startup, this project needs to be loaded automatically. It must be listed in the variables MS_VBAAUTOLOADPROJECTS. &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="white-space:normal;text-transform:none;color:rgb(0,0,0);margin:1.5em 0px;letter-spacing:normal;background-color:rgb(255,255,255);text-indent:0px;"&gt;&lt;font&gt;&lt;font color="black" face="Times New Roman"&gt;You can also edit the variable or simply make a hook in the project editor as shown circled here:&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="white-space:normal;text-transform:none;color:rgb(0,0,0);margin:1.5em 0px;letter-spacing:normal;background-color:rgb(255,255,255);text-indent:0px;"&gt;&lt;font face="Times New Roman"&gt;7777777777777&lt;/font&gt;&lt;/p&gt;&lt;p style="white-space:normal;text-transform:none;color:rgb(0,0,0);margin:1.5em 0px;letter-spacing:normal;background-color:rgb(255,255,255);text-indent:0px;"&gt;&lt;font face="Times New Roman"&gt;When you restart Microstation, the OnProjectLoad routine is automaticall loaded and executed, as can be seen below:&lt;/font&gt;&lt;/p&gt;&lt;p style="white-space:normal;text-transform:none;color:rgb(0,0,0);margin:1.5em 0px;letter-spacing:normal;background-color:rgb(255,255,255);text-indent:0px;"&gt;&lt;font face="Times New Roman"&gt;8888888888888&lt;/font&gt;&lt;/p&gt;&lt;p style="white-space:normal;text-transform:none;color:rgb(0,0,0);margin:1.5em 0px;letter-spacing:normal;background-color:rgb(255,255,255);text-indent:0px;"&gt;&lt;font face="Times New Roman"&gt;Not only does this screenshot show that the routine was executed, but that the subroutine is already running during the startup of Microstation.&lt;/font&gt;&lt;/p&gt;&lt;p style="white-space:normal;text-transform:none;color:rgb(0,0,0);margin:1.5em 0px;letter-spacing:normal;background-color:rgb(255,255,255);text-indent:0px;"&gt;&lt;font face="Times New Roman"&gt;Behind the message box is still the splashscreen of Microstation, so the subroutine has already been carried out before the Microstation Manager to select a drawing appears.&lt;/font&gt;&lt;/p&gt;&lt;p style="white-space:normal;text-transform:none;color:rgb(0,0,0);margin:1.5em 0px;letter-spacing:normal;background-color:rgb(255,255,255);text-indent:0px;"&gt;&lt;font face="Times New Roman"&gt;It is important at this point to note that although commands can be executed, commands relating to the contents of a drawing leads to errors. It is still possible, however, but the installation of an event handler that catches the opening of a drawing is required. More information about this can be found in the following article.&lt;/font&gt;&lt;/p&gt;&lt;p style="white-space:normal;text-transform:none;color:rgb(0,0,0);margin:1.5em 0px;letter-spacing:normal;background-color:rgb(255,255,255);text-indent:0px;"&gt;&lt;font face="Times New Roman"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="white-space:normal;text-transform:none;color:rgb(0,0,0);margin:1.5em 0px;letter-spacing:normal;background-color:rgb(255,255,255);text-indent:0px;"&gt;&lt;font face="Times New Roman"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="white-space:normal;text-transform:none;color:rgb(0,0,0);margin:1.5em 0px;letter-spacing:normal;background-color:rgb(255,255,255);text-indent:0px;"&gt;&lt;font face="Times New Roman"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: VBAWindows 7 32 bit, MicroStation, Windows 7 64 bit, Programming, en, 08.11.09.578, SELECTsupport&lt;/div&gt;
</description></item></channel></rss>