<?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 execution when opening or closing drawings</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21845/automatic-execution-when-opening-or-closing-drawings</link><description>Bentley View, MicroStation, PowerDraft</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>Automatic execution when opening or closing drawings</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21845/automatic-execution-when-opening-or-closing-drawings</link><pubDate>Thu, 09 Sep 2021 11:59:35 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:e26083f1-3965-495f-b18c-33dedd6fbfc9</guid><dc:creator>Robert Hook</dc:creator><comments>https://communities.bentley.com/products/microstation/w/microstation__wiki/21845/automatic-execution-when-opening-or-closing-drawings#comments</comments><description>Current Revision posted to MicroStation Wiki by Robert Hook on 9/9/2021 11:59:35 AM&lt;br /&gt;
&lt;h1&gt;&lt;b&gt;&lt;img style="border-width:0px;" alt=" " height="60" src="/cfs-file.ashx/__key/communityserver-components-sitefiles/TSG-Logo.png" width="189" /&gt;&lt;/b&gt;&lt;/h1&gt;
&lt;table style="background-color:#dce5f0;border:0px solid #dce5f0;width:500px;" 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;We are often faced with the task of having to carry out actions during the opening or closing of drawings. These actions can include making adjustments or launching control routines that check and correct drawings.&lt;br /&gt;Here is a small example created largely from the MicroStation VBA Help that is modified and compiled.&lt;br /&gt;In the previous article explaining automatically loading VBA routines, it has already been noted that it is possible to automatically execute something, but this happens before the drawing file is opened.&lt;br /&gt;Therefore, this example can bee seen more as an extension. Because there is an event handler installed in this example, after running the VBA routine, every time you open or close a drawing, an event is intercepted. This makes it easy to implement something to run later when these events occur.&lt;br /&gt;These events are indicated by a message box in this example, but this can be changed accordingly for your own use.&lt;br /&gt;A module with the subroutine &lt;a href="/products/microstation/w/microstation__wiki/21844/automatic-subroutine-loading" rel="noopener noreferrer" target="_blank"&gt;OnProjectLoad&lt;/a&gt; might look something like this:&lt;/p&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Dim oOpenClose As clsOpenClose
Under  OnProjectLoad ()
        Set oOpenClose = New clsOpenClose
        MsgBox &amp;quot;Eventhandler geladen&amp;quot;
End Sub&lt;/pre&gt;
&lt;p&gt;To load this VBA routine when you start MicroStation, it must be listed under the MS_VBAAUTOLOADPROJECTS, and the clsOpenClose module must also be loaded. &lt;br /&gt;Here is a class module clsOpenClose that must be created separately in the defined class modules:&lt;br /&gt;Dim WithEvents hooks As Application&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Private Sub Class_Initialize()
    Set hooks = Application
End Sub
Private  Sub  hooks_OnDesignFileClosed ( ByVal  DesignFileName As  String )
    MsgBox ActiveDesignFile.FullName + &amp;quot;closed&amp;quot;
End Sub
 
Private  Sub  hooks_OnDesignFileOpened ( ByVal  Design Filename As  String )
    MsgBox ActiveDesignFile.FullName + &amp;quot;opened&amp;quot;
End Sub&lt;/pre&gt;
&lt;p&gt;In this example, two events OnDesignFileOpened and OnDesignFileClosed are intercepted when opening and closing a drawing. They both open a message box indicating whether the file has been opened or closed.&lt;br /&gt;For simplicity, this example is stored as a complete VBA project and can be downloaded here:&lt;br /&gt;&lt;a href="/communities/user_communities/bentley_general_de/m/bentleygeneralde-files/188840/download.aspx"&gt;VBA routine to install and event handler&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="color:#7f0055;font-weight:bold;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: VBA, Programming, 08.11.09.578, SELECTsupport&lt;/div&gt;
</description></item><item><title>Automatic execution when opening or closing drawings</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21845/automatic-execution-when-opening-or-closing-drawings/revision/7</link><pubDate>Fri, 10 Feb 2017 05:52:26 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:e26083f1-3965-495f-b18c-33dedd6fbfc9</guid><dc:creator>Andrew Bell</dc:creator><comments>https://communities.bentley.com/products/microstation/w/microstation__wiki/21845/automatic-execution-when-opening-or-closing-drawings#comments</comments><description>Revision 7 posted to MicroStation Wiki by Andrew Bell on 2/10/2017 5:52:26 AM&lt;br /&gt;
&lt;h1&gt;&lt;b&gt;&lt;img width="189" height="60" style="border-width:0px;" alt=" " src="/cfs-file.ashx/__key/communityserver-components-sitefiles/TSG-Logo.png" /&gt;&lt;/b&gt;&lt;/h1&gt;
&lt;table style="border:0px solid #dce5f0;width:500px;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;We are often faced with the task of having to carry out actions during the opening or closing of drawings. These actions can include making adjustments or launching control routines that check and correct drawings.&lt;br /&gt;Here is a small example created largely from the MicroStation VBA Help that is modified and compiled.&lt;br /&gt;In the previous article explaining automatically loading VBA routines, it has already been noted that it is possible to automatically execute something, but this happens before the drawing file is opened.&lt;br /&gt;Therefore, this example can bee seen more as an extension. Because there is an event handler installed in this example, after running the VBA routine, every time you open or close a drawing, an event is intercepted. This makes it easy to implement something to run later when these events occur.&lt;br /&gt;These events are indicated by a message box in this example, but this can be changed accordingly for your own use.&lt;br /&gt;A module with the subroutine OnProjectLoad might look something like this:&lt;/p&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Dim oOpenClose As clsOpenClose
Under  OnProjectLoad ()
        Set oOpenClose = New clsOpenClose
        MsgBox &amp;quot;Eventhandler geladen&amp;quot;
End Sub&lt;/pre&gt;
&lt;p&gt;To load this VBA routine when you start MicroStation, it must be listed under the MS_VBAAUTOLOADPROJECTS, and the clsOpenClose module must also be loaded. &lt;br /&gt;Here is a class module clsOpenClose that must be created separately in the defined class modules:&lt;br /&gt;Dim WithEvents hooks As Application&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Private Sub Class_Initialize()
    Set hooks = Application
End Sub
Private  Sub  hooks_OnDesignFileClosed ( ByVal  DesignFileName As  String )
    MsgBox ActiveDesignFile.FullName + &amp;quot;closed&amp;quot;
End Sub
 
Private  Sub  hooks_OnDesignFileOpened ( ByVal  Design Filename As  String )
    MsgBox ActiveDesignFile.FullName + &amp;quot;opened&amp;quot;
End Sub&lt;/pre&gt;
&lt;p&gt;In this example, two events OnDesignFileOpened and OnDesignFileClosed are intercepted when opening and closing a drawing. They both open a message box indicating whether the file has been opened or closed.&lt;br /&gt;For simplicity, this example is stored as a complete VBA project and can be downloaded here:&lt;br /&gt;&lt;a href="/communities/user_communities/bentley_general_de/m/bentleygeneralde-files/188840/download.aspx"&gt;VBA routine to install and event handler&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight:bold;color:#7f0055;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: VBA, Programming, 08.11.09.578, SELECTsupport&lt;/div&gt;
</description></item><item><title>Automatic execution when openeing or closing drawings</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21845/automatic-execution-when-opening-or-closing-drawings/revision/6</link><pubDate>Thu, 09 Jul 2015 13:11:09 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:e26083f1-3965-495f-b18c-33dedd6fbfc9</guid><dc:creator>Maggie Fortescue</dc:creator><comments>https://communities.bentley.com/products/microstation/w/microstation__wiki/21845/automatic-execution-when-opening-or-closing-drawings#comments</comments><description>Revision 6 posted to MicroStation Wiki by Maggie Fortescue on 7/9/2015 1:11:09 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;We are often faced with the task of having to carry out actions during the opening or closing of drawings. These actions can include making adjustments or launching control routines that check and correct drawings.&lt;br /&gt;Here is a small example created largely from the MicroStation VBA Help that is modified and compiled.&lt;br /&gt;In the previous article explaining automatically loading VBA routines, it has already been noted that it is possible to automatically execute something, but this happens before the drawing file is opened.&lt;br /&gt;Therefore, this example can bee seen more as an extension. Because there is an event handler installed in this example, after running the VBA routine, every time you open or close a drawing, an event is intercepted. This makes it easy to implement something to run later when these events occur.&lt;br /&gt;These events are indicated by a message box in this example, but this can be changed accordingly for your own use.&lt;br /&gt;A module with the subroutine OnProjectLoad might look something like this:&lt;/p&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Dim oOpenClose As clsOpenClose
Under  OnProjectLoad ()
        Set oOpenClose = New clsOpenClose
        MsgBox &amp;quot;Eventhandler geladen&amp;quot;
End Sub&lt;/pre&gt;
&lt;p&gt;To load this VBA routine when you start MicroStation, it must be listed under the MS_VBAAUTOLOADPROJECTS, and the clsOpenClose module must also be loaded. &lt;br /&gt;Here is a class module clsOpenClose that must be created separately in the defined class modules:&lt;br /&gt;Dim WithEvents hooks As Application&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Private Sub Class_Initialize()
    Set hooks = Application
End Sub
Private  Sub  hooks_OnDesignFileClosed ( ByVal  DesignFileName As  String )
    MsgBox ActiveDesignFile.FullName + &amp;quot;closed&amp;quot;
End Sub
 
Private  Sub  hooks_OnDesignFileOpened ( ByVal  Design Filename As  String )
    MsgBox ActiveDesignFile.FullName + &amp;quot;opened&amp;quot;
End Sub&lt;/pre&gt;
&lt;p&gt;In this example, two events OnDesignFileOpened and OnDesignFileClosed are intercepted when opening and closing a drawing. They both open a message box indicating whether the file has been opened or closed.&lt;br /&gt;For simplicity, this example is stored as a complete VBA project and can be downloaded here:&lt;br /&gt;&lt;a href="/communities/user_communities/bentley_general_de/m/bentleygeneralde-files/188840/download.aspx"&gt;VBA routine to install and event handler&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight:bold;color:#7f0055;"&gt;&lt;/span&gt;&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 execution when openeing or closing drawings</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21845/automatic-execution-when-opening-or-closing-drawings/revision/5</link><pubDate>Wed, 08 Jul 2015 21:31:30 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:e26083f1-3965-495f-b18c-33dedd6fbfc9</guid><dc:creator>Maggie Fortescue</dc:creator><comments>https://communities.bentley.com/products/microstation/w/microstation__wiki/21845/automatic-execution-when-opening-or-closing-drawings#comments</comments><description>Revision 5 posted to MicroStation Wiki by Maggie Fortescue on 7/8/2015 9:31: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;We are often faced with the task of having to carry out some actions during the opening or closing of drawings. These actions can include making adjustments or launching control routines that check and correct drawings.&lt;br /&gt;Here is a small example created largely from the MicroStation VBA Help that is modified and compiled.&lt;br /&gt;In the previous article explaining automatically loading VBA routines, it has already been noted that it is possible to automatically execute something, but this happens before the drawing file is opened.&lt;br /&gt;Therefore, this example can bee seen more as an extension. Because there is an event handler installed in this example, after running the VBA routine, every time you open or close a drawing, an event is intercepted. This makes it easy to implement something later to run when these events occur.&lt;br /&gt;These events are indicated by a message box in this example, but this can be changed accordingly for your own use.&lt;br /&gt;A module with the subroutine OnProjectLoad might look something like this:&lt;/p&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Dim oOpenClose As clsOpenClose
Under  OnProjectLoad ()
        Set oOpenClose = New clsOpenClose
        MsgBox &amp;quot;Eventhandler geladen&amp;quot;
End Sub&lt;/pre&gt;
&lt;p&gt;To load this VBA routine when you start MicroStation, it must be listed under the MS_VBAAUTOLOADPROJECTS, and the clsOpenClose module must also be loaded. &lt;br /&gt;Here is a class module clsOpenClose that must be created separately in the defined class modules:&lt;br /&gt;Dim WithEvents hooks As Application&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Private Sub Class_Initialize()
    Set hooks = Application
End Sub
Private  Sub  hooks_OnDesignFileClosed ( ByVal  DesignFileName As  String )
    MsgBox ActiveDesignFile.FullName + &amp;quot;closed&amp;quot;
End Sub
 
Private  Sub  hooks_OnDesignFileOpened ( ByVal  Design Filename As  String )
    MsgBox ActiveDesignFile.FullName + &amp;quot;opened&amp;quot;
End Sub&lt;/pre&gt;
&lt;p&gt;In this example, two events OnDesignFileOpened and OnDesignFileClosed are intercepted when opening and closing a drawing. They both open a message box indicating whether the file has been opened or closed.&lt;br /&gt;For simplicity, this example is stored as a complete VBA project and can be downloaded here:&lt;br /&gt;&lt;a href="/communities/user_communities/bentley_general_de/m/bentleygeneralde-files/188840/download.aspx"&gt;VBA routine to install and event handler&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight:bold;color:#7f0055;"&gt;&lt;/span&gt;&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 execution when openeing or closing drawings</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21845/automatic-execution-when-opening-or-closing-drawings/revision/4</link><pubDate>Wed, 08 Jul 2015 20:24:47 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:e26083f1-3965-495f-b18c-33dedd6fbfc9</guid><dc:creator>Maggie Fortescue</dc:creator><comments>https://communities.bentley.com/products/microstation/w/microstation__wiki/21845/automatic-execution-when-opening-or-closing-drawings#comments</comments><description>Revision 4 posted to MicroStation Wiki by Maggie Fortescue on 7/8/2015 8:24:47 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;We are often faced with the task of having to carry out some actions during the opening or closing of drawings. These actions can include &amp;nbsp;making adjustments or launching control routines that check and correct drawings.&lt;br /&gt;Here is a small example created largely from the MicroStation VBA Help that is modified and compiled.&lt;br /&gt;In the previous article explaining automatically loading VBA routines, it has already been noted that it is possible to automatically execute something, but this happens before the drawing file is opened.&lt;br /&gt;Therefore, this example can bee seen more as an extension. Because there is an event handler installed in this example, after running the VBA routine, every time you open or close a drawing, an event is intercepted. This makes it easy to implement something later to run when these events occur.&lt;br /&gt;These events are indicated by a message box in this example, but this can be changed accordingly for your own use.&lt;br /&gt;A module with the subroutine OnProjectLoad might look something like this:&lt;/p&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Dim oOpenClose As clsOpenClose
Under  OnProjectLoad ()
        Set oOpenClose = New clsOpenClose
        MsgBox &amp;quot;Eventhandler geladen&amp;quot;
End Sub&lt;/pre&gt;
&lt;p&gt;To load this VBA routine when you start MicroStation, it must be listed under the MS_VBAAUTOLOADPROJECTS, and the clsOpenClose module must also be loaded. &lt;br /&gt;Here is a class module clsOpenClose that must be created separately in the defined class modules:&lt;br /&gt;Dim WithEvents hooks As Application&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Private Sub Class_Initialize()
    Set hooks = Application
End Sub
Private  Sub  hooks_OnDesignFileClosed ( ByVal  DesignFileName As  String )
    MsgBox ActiveDesignFile.FullName + &amp;quot;closed&amp;quot;
End Sub
 
Private  Sub  hooks_OnDesignFileOpened ( ByVal  Design Filename As  String )
    MsgBox ActiveDesignFile.FullName + &amp;quot;opened&amp;quot;
End Sub&lt;/pre&gt;
&lt;p&gt;In this example, two events OnDesignFileOpened and OnDesignFileClosed are intercepted when opening and closing a drawing. They both open a message box indicating whether the file has been opened or closed.&lt;br /&gt;For simplicity, this example is stored as a complete VBA project and can be downloaded here:&lt;br /&gt;&lt;a href="/communities/user_communities/bentley_general_de/m/bentleygeneralde-files/188840/download.aspx"&gt;VBA routine to install and event handler&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight:bold;color:#7f0055;"&gt;&lt;/span&gt;&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 execution when openeing or closing drawings</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21845/automatic-execution-when-opening-or-closing-drawings/revision/3</link><pubDate>Wed, 08 Jul 2015 20:20:36 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:e26083f1-3965-495f-b18c-33dedd6fbfc9</guid><dc:creator>Maggie Fortescue</dc:creator><comments>https://communities.bentley.com/products/microstation/w/microstation__wiki/21845/automatic-execution-when-opening-or-closing-drawings#comments</comments><description>Revision 3 posted to MicroStation Wiki by Maggie Fortescue on 7/8/2015 8:20:36 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;We are often faced with the task of having to carry out some actions during the opening or closing of drawings, be it making adjustments or launching control routines that check and correct drawings.&lt;br /&gt;Here is a small example created largely from the Microstation VBA Help but modified and compiled.&lt;br /&gt;In the previous article explaining automatically loading VBA routines, it has already been noted that it is possible to automatically execute something, but this happens before the drawing file is opened.&lt;br /&gt;Therefore, this example can bee seen more as an extension. Because there is an event handler installed in this example, after running the VBA routine, every time you open or close a drawing, an event is intercepted. This makes it easy to implement something later to run when these events occur.&lt;br /&gt;These events are indicated by a message box in this example, but this can be changed accordingly for your own use.&lt;br /&gt;A module with the subroutine OnProjectLoad might look something like this:&lt;/p&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Dim oOpenClose As clsOpenClose
Under  OnProjectLoad ()
        Set oOpenClose = New clsOpenClose
        MsgBox &amp;quot;Eventhandler geladen&amp;quot;
End Sub&lt;/pre&gt;
&lt;p&gt;To load this VBA routine when you start MicroStation, it must be listed under the MS_VBAAUTOLOADPROJECTS, and the clsOpenClose module must also be loaded. &lt;br /&gt;Here is a class module clsOpenClose that must be created separately in the defined class modules:&lt;br /&gt;Dim WithEvents hooks As Application&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Private Sub Class_Initialize()
    Set hooks = Application
End Sub
Private  Sub  hooks_OnDesignFileClosed ( ByVal  DesignFileName As  String )
    MsgBox ActiveDesignFile.FullName + &amp;quot;closed&amp;quot;
End Sub
 
Private  Sub  hooks_OnDesignFileOpened ( ByVal  Design Filename As  String )
    MsgBox ActiveDesignFile.FullName + &amp;quot;opened&amp;quot;
End Sub&lt;/pre&gt;
&lt;p&gt;In this example, two events OnDesignFileOpened and OnDesignFileClosed are intercepted when opening and closing a drawing. They both open a message box indicating whether the file has been opened or closed.&lt;br /&gt;For simplicity, this example is stored as a complete VBA project and can be downloaded here:&lt;br /&gt;&lt;a href="/communities/user_communities/bentley_general_de/m/bentleygeneralde-files/188840/download.aspx"&gt;VBA routine to install and event handler&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight:bold;color:#7f0055;"&gt;&lt;/span&gt;&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 execution when openeing or closing drawings</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21845/automatic-execution-when-opening-or-closing-drawings/revision/2</link><pubDate>Mon, 08 Jun 2015 17:47:33 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:e26083f1-3965-495f-b18c-33dedd6fbfc9</guid><dc:creator>Tristan Anderson</dc:creator><comments>https://communities.bentley.com/products/microstation/w/microstation__wiki/21845/automatic-execution-when-opening-or-closing-drawings#comments</comments><description>Revision 2 posted to MicroStation Wiki by Tristan Anderson on 6/8/2015 5:47:33 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;We are often faced with the task of having to carry out some actions during the opening or closing of drawings, be it making adjustments or launching control routines that check and correct drawings.&lt;br /&gt;Here is a small example created largely from the Microstation VBA Help but modified and compiled.&lt;br /&gt;In the previous article explaining automatically loading VBA routines, it has already been noted that it is possible to automatically execute something, but this happens before the drawing file is opened.&lt;br /&gt;Therefore, this example can bee seen more as an extension. Because there is an event handler installed in this example, after running the VBA routine, every time you open or close a drawing, an event is intercepted. This makes it easy to impliment something later to run when these events occur.&lt;br /&gt;These events are indicated by a message box in this example, but this can be changed accordingly for your own use.&lt;br /&gt;A module with the subroutine OnProjectLoad might look something like this:&lt;/p&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Dim oOpenClose As clsOpenClose
Under  OnProjectLoad ()
        Set oOpenClose = New clsOpenClose
        MsgBox &amp;quot;Eventhandler geladen&amp;quot;
End Sub&lt;/pre&gt;
&lt;p&gt;To load this VBA routine when you start MicroStation, it must be listed under the MS_VBAAUTOLOADPROJECTS, and the clsOpenClose module must also be loaded. &lt;br /&gt;Here is a class module clsOpenClose that must be created seperately in the defined class modules:&lt;br /&gt;Dim WithEvents hooks As Application&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Private Sub Class_Initialize()
    Set hooks = Application
End Sub
Private  Sub  hooks_OnDesignFileClosed ( ByVal  DesignFileName As  String )
    MsgBox ActiveDesignFile.FullName + &amp;quot;closed&amp;quot;
End Sub
 
Private  Sub  hooks_OnDesignFileOpened ( ByVal  Design Filename As  String )
    MsgBox ActiveDesignFile.FullName + &amp;quot;opened&amp;quot;
End Sub&lt;/pre&gt;
&lt;p&gt;In this example, two events OnDesignFileOpened and OnDesignFileClosed are intercepted when opening and closing a drawing. They both open a message box indicating whether the file has been opened or closed.&lt;br /&gt;For simplicity, this example is stored as a complete VBA project and can be downloaded here:&lt;br /&gt;&lt;a href="/communities/user_communities/bentley_general_de/m/bentleygeneralde-files/188840/download.aspx"&gt;VBA routine to install and event handler&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight:bold;color:#7f0055;"&gt;&lt;/span&gt;&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 execution when openeing or closing drawings</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21845/automatic-execution-when-opening-or-closing-drawings/revision/1</link><pubDate>Mon, 08 Jun 2015 17:45:37 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:e26083f1-3965-495f-b18c-33dedd6fbfc9</guid><dc:creator>Tristan Anderson</dc:creator><comments>https://communities.bentley.com/products/microstation/w/microstation__wiki/21845/automatic-execution-when-opening-or-closing-drawings#comments</comments><description>Revision 1 posted to MicroStation Wiki by Tristan Anderson on 6/8/2015 5:45:37 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;We are often faced with the task of having to carry out some actions during the opening or closing of drawings, be it making adjustments or launching control routines that check and correct drawings.&lt;br /&gt;Here is a small example created largely from the Microstation VBA Help but modified and compiled.&lt;br /&gt;In the previous article explaining automatically loading VBA routines, it has already been noted that it is possible to automatically execute something, but this happens before the drawing file is opened.&lt;br /&gt;Therefore, this example can bee seen more as an extension. Because there is an event handler installed in this example, after running the VBA routine, every time you open or close a drawing, an event is intercepted. This makes it easy to impliment something later to run when these events occur.&lt;br /&gt;These events are indicated by a message box in this example, but this can be changed accordingly for your own use.&lt;br /&gt;A module with the subroutine OnProjectLoad might look something like this:&lt;/p&gt;
&lt;p&gt;Dim oOpenClose As clsOpenClose&lt;br /&gt;Under&amp;nbsp; OnProjectLoad ()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set oOpenClose = New clsOpenClose&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox &amp;quot;Eventhandler geladen&amp;quot;&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;To load this VBA routine when you start MicroStation, it must be listed under the MS_VBAAUTOLOADPROJECTS, and the clsOpenClose module must also be loaded. &lt;br /&gt;Here is a class module clsOpenClose that must be created seperately in the defined class modules:&lt;br /&gt;Dim WithEvents hooks As Application&lt;br /&gt;&amp;nbsp;&lt;br /&gt;Private Sub Class_Initialize()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set hooks = Application&lt;br /&gt;End Sub&lt;br /&gt;Private&amp;nbsp; Sub&amp;nbsp; hooks_OnDesignFileClosed ( ByVal&amp;nbsp; DesignFileName As&amp;nbsp; String )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox ActiveDesignFile.FullName + &amp;quot;closed&amp;quot;&lt;br /&gt;End Sub&lt;br /&gt;&amp;nbsp;&lt;br /&gt;Private&amp;nbsp; Sub&amp;nbsp; hooks_OnDesignFileOpened ( ByVal&amp;nbsp; Design Filename As&amp;nbsp; String )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox ActiveDesignFile.FullName + &amp;quot;opened&amp;quot;&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;In this example, two events OnDesignFileOpened and OnDesignFileClosed are intercepted when opening and closing a drawing. They both open a message box indicating whether the file has been opened or closed.&lt;br /&gt;For simplicity, this example is stored as a complete VBA project and can be downloaded here:&lt;br /&gt;&lt;a href="http://communities.bentley.com/communities/user_communities/bentley_general_de/m/bentleygeneralde-files/188840/download.aspx"&gt;VBA routine to install and event handler&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight:bold;color:rgb(127,0,85);"&gt;&lt;/span&gt;&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></channel></rss>