<?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/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>[V8i VBA] Open Next .dgn file</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/102062/v8i-vba-open-next-dgn-file</link><description>I have created a VBA macro (code below) that opens the next .dgn file in the current folder. I created a custom tool and I run it from there. I created another, similar, macro that opens the &amp;quot;previous&amp;quot; drawing (not the previously opened dgn). It works</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: [V8i VBA] Open Next .dgn file</title><link>https://communities.bentley.com/thread/690656?ContentTypeID=1</link><pubDate>Sat, 08 Jan 2022 11:15:51 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:75170582-6675-4773-b56a-db4861c649ab</guid><dc:creator>Jon Summers</dc:creator><description>[quote userid="1106331" url="~/products/programming/microstation_programming/f/microstation-programming---forum/102062/v8i-vba-open-next-dgn-file/690433"]I am browsing the Microsoft Scripting Runtime in Microstation VBA Editor, I cannot find it[/quote]
&lt;p&gt;Once found, it appears at the top of the list.&lt;/p&gt;
&lt;p&gt;&lt;a title="LA Solutions: VBA Hints &amp;amp; Tips" href="http://www.la-solutions.co.uk/content/V8/mvba/MVBA-FilesAndFolders.htm#Scripting" rel="noopener noreferrer" target="_blank"&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/343173/pastedimage1641640568804v1.jpeg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Several of our example VBA projects use Microsoft Scripting Runtime.&amp;nbsp; For example, &lt;a title="LA Solutions: DGN Line Exporter" href="http://www.la-solutions.co.uk/content/connect/mvba/MVBA-LineExporter.htm" rel="noopener noreferrer" target="_blank"&gt;Export Line Data to CSV&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [V8i VBA] Open Next .dgn file</title><link>https://communities.bentley.com/thread/690438?ContentTypeID=1</link><pubDate>Thu, 06 Jan 2022 21:38:44 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:597a6635-dd08-4b40-9120-b3d362c30729</guid><dc:creator>Kefan Zhou</dc:creator><description>&lt;p&gt;Ugh,,,,, thank you!! Mine is on the tenth.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [V8i VBA] Open Next .dgn file</title><link>https://communities.bentley.com/thread/690436?ContentTypeID=1</link><pubDate>Thu, 06 Jan 2022 21:35:22 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:9f95a993-8445-4ff6-9f72-2735aa6c8448</guid><dc:creator>JM</dc:creator><description>&lt;p&gt;the available references are not sorted 100% alphabetically (at least for me they are not)&lt;/p&gt;
&lt;p&gt;try looking near the top of list, mine is in the top 10 if not already selected&lt;/p&gt;
&lt;p&gt;if you can&amp;#39;t find it in the list I don&amp;#39;t know, I think it should be there though&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [V8i VBA] Open Next .dgn file</title><link>https://communities.bentley.com/thread/690433?ContentTypeID=1</link><pubDate>Thu, 06 Jan 2022 21:29:40 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:b1511509-6eb4-4432-a3fb-99cfdaa42d41</guid><dc:creator>Kefan Zhou</dc:creator><description>&lt;p&gt;Hi JM,&lt;/p&gt;
&lt;p&gt;As I am browsing the Microsoft Scripting Runtime in Microstation VBA Editor, I cannot find it.&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/343173/pastedimage1641504610942v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;However, I can find it in the vba editor in excel.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I try to manually load the&amp;nbsp;&lt;span&gt;scrrun.dll with the Browse, but after loading it, nothing happens in the available references.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Any suggestions?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [V8i VBA] Open Next .dgn file</title><link>https://communities.bentley.com/thread/690426?ContentTypeID=1</link><pubDate>Thu, 06 Jan 2022 19:15:20 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:efeb72c3-0ac9-4784-9d92-d043af99109d</guid><dc:creator>JM</dc:creator><description>&lt;p&gt;if you read the comments at beginning of code you will see&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;#39;if Compile error = &amp;quot;User-defined type not defined&amp;quot;&lt;br /&gt;&amp;#39;requires &amp;quot;MicroSoft Scripting Runtime&amp;quot; reference (Tools&amp;gt; References)&lt;/p&gt;
&lt;p&gt;you need to add the reference in VBA IDE, it won&amp;#39;t work without it&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [V8i VBA] Open Next .dgn file</title><link>https://communities.bentley.com/thread/690423?ContentTypeID=1</link><pubDate>Thu, 06 Jan 2022 19:09:54 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:23d203e3-e493-48d7-b748-9d2549732943</guid><dc:creator>Kefan Zhou</dc:creator><description>&lt;p&gt;Hi Jan,&lt;/p&gt;
&lt;p&gt;I tried to run this code in Microstation mvba,&amp;nbsp;following shows:&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/343173/pastedimage1641496178859v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Any suggestion how to resolve this?&amp;nbsp;I still don&amp;#39;t quite get what &amp;quot;Scripting. &amp;quot; stands for.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;KZ&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [V8i VBA] Open Next .dgn file</title><link>https://communities.bentley.com/thread/459322?ContentTypeID=1</link><pubDate>Sun, 06 May 2018 07:11:52 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:3427c63f-bfc5-43f6-9c33-429559b66918</guid><dc:creator>Jon Summers</dc:creator><description>[quote userid="869597" url="~/products/programming/microstation_programming/f/microstation-programming---forum/102062/v8i-vba-open-next-dgn-file/459319"]I want to find the input tool to list the .dgn files in the directory,[/quote]
&lt;p&gt;Take a&amp;nbsp; look at this &lt;a title="LA Solutions: Next &amp;amp; Previous File Browser" href="http://www.la-solutions.co.uk/content/V8/mvba/MVBA-NextFile.htm" rel="noopener noreferrer" target="_blank"&gt;VBA project &lt;em&gt;Next File&lt;/em&gt; for MicroStation&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a title="LA Solutions: Next and Previous File Browser" href="http://www.la-solutions.co.uk/content/V8/mvba/MVBA-NextFile.htm" rel="noopener noreferrer" target="_blank"&gt;&lt;em&gt;&lt;img alt="Next and Previous File Browser for MicroStation" src="http://www.la-solutions.co.uk/content/V8/mvba/images/dlgNextFile.png" /&gt;&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [V8i VBA] Open Next .dgn file</title><link>https://communities.bentley.com/thread/459319?ContentTypeID=1</link><pubDate>Sun, 06 May 2018 06:05:39 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:7538a49c-f3dc-4e5c-b8c7-1a4f2d11c0fe</guid><dc:creator>Doan Nguyen Thuc</dc:creator><description>&lt;p&gt;&lt;span&gt;I want to find the input tool to list the .dgn files in the directory, by scanning the selected folders, maybe at different paths, then if i press forward then it will open the next file Otherwise, it will back up, or I will choose a random file and it will open to the file. DGN, hope you help me. Thank you very much, good day&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [V8i VBA] Open Next .dgn file</title><link>https://communities.bentley.com/thread/459318?ContentTypeID=1</link><pubDate>Sun, 06 May 2018 06:04:38 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:23cb7a48-f69f-45d5-8e41-be9567236360</guid><dc:creator>Doan Nguyen Thuc</dc:creator><description>&lt;p&gt;&lt;span&gt;I want to find the input tool to list the .dgn files in the directory, by scanning the selected folders, maybe at different paths, then if i press forward then it will open the next file Otherwise, it will back up, or I will choose a random file and it will open to the file. DGN, hope you help me. Thank you very much, good day.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [V8i VBA] Open Next .dgn file</title><link>https://communities.bentley.com/thread/303753?ContentTypeID=1</link><pubDate>Thu, 23 Oct 2014 14:13:28 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:120a4bde-70b7-4856-ac11-ca51219157fe</guid><dc:creator>JJ Wutt</dc:creator><description>Jon, Excellent point. Thanks!&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [V8i VBA] Open Next .dgn file</title><link>https://communities.bentley.com/thread/303751?ContentTypeID=1</link><pubDate>Thu, 23 Oct 2014 14:12:32 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:8e450c10-1981-4c6b-bb37-ab988cc4b230</guid><dc:creator>JJ Wutt</dc:creator><description>Jan, Thanks for the book suggestions and comments! I will have to check those out.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [V8i VBA] Open Next .dgn file</title><link>https://communities.bentley.com/thread/303710?ContentTypeID=1</link><pubDate>Thu, 23 Oct 2014 06:33:59 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:c9a17e9b-22ec-44d2-96cc-bb77b6b3eb1c</guid><dc:creator>Jon Summers</dc:creator><description>[quote user="&amp;quot;JJ"]&lt;code class="vb keyword"&gt;If&lt;/code&gt; &lt;code class="vb plain"&gt;Right(oFile.Name, 3) = &lt;/code&gt;&lt;code class="vb string"&gt;&amp;quot;dgn&amp;quot;&lt;/code&gt; &lt;code class="vb keyword"&gt;Then&lt;/code&gt;[/quote]
&lt;p&gt;That tells you if a three-letter file extension matches &amp;#39;dgn&amp;#39; exactly.&amp;nbsp; What if the extension is &amp;#39;DGN&amp;#39; (i.e. upper-case &lt;code&gt;DGN&lt;/code&gt; not lower-case &lt;code&gt;dgn&lt;/code&gt;)?&amp;nbsp; What if the project uses DGN files having a different extension?&lt;/p&gt;
&lt;p&gt;Read this article about how to &lt;a title="LA Solutions: Check a Design File with VBA" href="http://www.la-solutions.co.uk/content/V8/MVBA/MVBA-VerifyFile.htm" rel="noopener noreferrer" target="_blank"&gt;Check a Design File with VBA&lt;/a&gt;.&amp;nbsp; It shows a way to check any file to find if MicroStation can open it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [V8i VBA] Open Next .dgn file</title><link>https://communities.bentley.com/thread/303703?ContentTypeID=1</link><pubDate>Thu, 23 Oct 2014 04:25:12 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:39f8f897-dc5f-45f0-aa90-8ad7f28ba505</guid><dc:creator>Jan Šlegr</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;[quote user=&amp;quot;JJ Wutt&amp;quot;]It works, but I&amp;#39;m a novice at programming and I wonder if the code could be streamlined (better organized?)[/quote]&lt;/p&gt;
&lt;p&gt;It&amp;#39;s an eternal question if a code is good enough or can be implemented in some better way ... but at the same time what does it mean &amp;quot;better way&amp;quot; is also important and tricky question ;-) To ask these questions are in my opinion one of mandatory conditions to become better programmer.&lt;/p&gt;
&lt;p&gt;If you are serious about your development skills, I strongly recommend to read &lt;a target="_blank" title="Clean Code: A Handbook of Agile Software Craftsmanship" href="http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882"&gt;Clean Code: A Handbook of Agile Software Craftsmanship&lt;/a&gt; (don&amp;#39;t mix up with&amp;nbsp;&lt;a target="_blank" title="The Clean Coder: A Code of Conduct for Professional Programmers" href="http://www.amazon.com/dp/0137081073/?tag=stackoverfl08-20"&gt;The Clean Coder: A Code of Conduct for Professional Programmers&lt;/a&gt; from the same author). If you are beginner, the first 7 or 8 chapters are the most valuable for you and you will find plenty of ideas and examples how to refactor the code to be better (and also some ideas what &amp;quot;better&amp;quot; means). Don&amp;#39;t care the examples are in Java, overall concepts and ideas are general.&lt;/p&gt;
&lt;p&gt;Also webs like StackExchange (especially &lt;a target="_blank" href="http://programmers.stackexchange.com/"&gt;Programmers&lt;/a&gt; and &lt;a target="_blank" href="http://stackoverflow.com/"&gt;Stack Overflow&lt;/a&gt;) can provide you plenty of advices and ideas what rules to follow to create better code (e.g. check &lt;a target="_blank" href="http://programmers.stackexchange.com/questions/133404/what-is-the-ideal-length-of-a-method"&gt;this discussion&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Reading your code (and not thinking too much about it as VBA is not my favorite languge ;-), I recommend to follow a rule of a &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Single_responsibility_principle"&gt;single responsibility&lt;/a&gt;, which comes from object oriented programming world, but can be used also in VBA: One function has to be responsible for one thing. Contrary to the rule, your code does many things (creates array of file names, iterate through it, opens file etc.) If you will break the code to more subs, you will also be closer to a rule every function should be short (even just a few lines).&lt;/p&gt;
&lt;p&gt;With regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>