<?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>OpenBuildings VBA SheetNumber Model Property</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/200313/openbuildings-vba-sheetnumber-model-property</link><description>Hello all, 
 I&amp;#39;m having the hardest time figuring out what OBD (v10.05.00.049) wants me to call the &amp;quot;Sheet Number&amp;quot; model property through VBA. I&amp;#39;ve set up a search criteria to scan all my tags in my drawing. When it gets to the drawing number tag, I want</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: OpenBuildings VBA SheetNumber Model Property</title><link>https://communities.bentley.com/thread/598286?ContentTypeID=1</link><pubDate>Wed, 15 Jul 2020 08:36:11 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:2baa6d2d-1e35-4931-a344-3edc6efc9c27</guid><dc:creator>Jan Šlegr</dc:creator><description>[quote userid="91013" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200313/openbuildings-vba-sheetnumber-model-property/598108"]Because of the inconsistency with naming I couldn&amp;#39;t follow which value was model property and which was sheet definition. [/quote]
&lt;p&gt;It&amp;#39;s simple, use Debug to compare values in GUI and values available in code:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/343173/BE_2D00_CE_2D00_VBA_2D00_Sheet_2D00_def.jpg" /&gt;&lt;/p&gt;
[quote userid="91013" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200313/openbuildings-vba-sheetnumber-model-property/598108"]I&amp;#39;m an end user with no formal training in VBA or Microstation code.[/quote]
&lt;p&gt;It&amp;#39;s hard to write a code in such case. You should buy and read &lt;a href="https://store.bentley.com/en/products/books/WAD00781A10001--Learning-MicroStation-VBA" rel="noopener noreferrer" target="_blank"&gt;Learning MicroStation VBA book&lt;/a&gt; at least. Even when it&amp;#39;s quite old and written for V8i, the most of its content is still valid, because VBA API did not change too much between V8i and CE.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OpenBuildings VBA SheetNumber Model Property</title><link>https://communities.bentley.com/thread/598108?ContentTypeID=1</link><pubDate>Tue, 14 Jul 2020 17:13:18 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:68ee1f70-d15a-4211-94ed-cf1e3ff60eb0</guid><dc:creator>Amador Ontiveros</dc:creator><description>&lt;p&gt;Thanks Jan, it&amp;#39;s working! One was a blatant error on my part. I was lacking the following code to write back to the definition.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;ActiveModelReference.SetSheetDefinition MySheetDef&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The other part isn&amp;#39;t a glitch, but as you stated&amp;nbsp;&lt;/p&gt;
[quote userid="2473" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200313/openbuildings-vba-sheetnumber-model-property/598089"]Because of confusing naming[/quote]
&lt;p&gt;OpenBuildings labels the value as &amp;quot;Sheet Number&amp;quot; in every GUI, but the code needed to call out &amp;quot;Name&amp;quot;, as follows&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;If Tag.TagDefinitionName = &amp;quot;drawing_number&amp;quot; Then
                MySheetDef.SheetName = Tag.Value
                ActiveModelReference.SetSheetDefinition MySheetDef
            End If&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Because of the inconsistency with naming I couldn&amp;#39;t follow which value was model property and which was sheet definition. I apologize, I&amp;#39;m an end user with no formal training in VBA or Microstation code.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks again for your help, I&amp;#39;ve marked your previous reply with the correct code as the correct answer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OpenBuildings VBA SheetNumber Model Property</title><link>https://communities.bentley.com/thread/598094?ContentTypeID=1</link><pubDate>Tue, 14 Jul 2020 16:45:09 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:d1136471-cf45-4578-9b7a-07d48ec2877f</guid><dc:creator>Jan Šlegr</dc:creator><description>[quote userid="91013" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200313/openbuildings-vba-sheetnumber-model-property/598092"]It does write back to the&amp;nbsp;&amp;quot;Description&amp;quot; column in the GUI, so I&amp;#39;m not sure I follow[/quote]
&lt;p&gt;What is not clear and what you do not follow?&lt;/p&gt;
&lt;p&gt;Description is ModelReference property.&lt;/p&gt;
&lt;p&gt;SheetNumber, SheetName etc. are SheetDefinition properties.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OpenBuildings VBA SheetNumber Model Property</title><link>https://communities.bentley.com/thread/598092?ContentTypeID=1</link><pubDate>Tue, 14 Jul 2020 16:39:00 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:09d96480-0b96-492b-b373-64ab2cf984df</guid><dc:creator>Amador Ontiveros</dc:creator><description>&lt;p&gt;Here is the image Jan&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/343173/SheetNumberGUI.JPG" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="2473" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200313/openbuildings-vba-sheetnumber-model-property/598089"]Of course it does. As Jon wrote, sheet number (as well as all other sheet properties) &lt;em&gt;&lt;span style="text-decoration:underline;"&gt;is not part&lt;/span&gt;&lt;/em&gt; of model data structure. It means you cannot access properties like sheet number, sheet name etc. using model reference (it just not makes sense). The right way, as demonstrated in my code, is to obtain SheetDefinition object at first.[/quote]
&lt;p&gt;If i change the code to&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;If Tag.TagDefinitionName = &amp;quot;drawing_number&amp;quot; Then
                MyModel.Description = Tag.Value
            End If&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It does write back to the&amp;nbsp;&amp;quot;Description&amp;quot; column in the GUI, so I&amp;#39;m not sure I follow... I posted in my reply to Jon that I used &amp;quot;.GetSheetDefinition&amp;quot;. I will start a new VBA session to test your code as is to see if it writes back.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks again for help with this!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OpenBuildings VBA SheetNumber Model Property</title><link>https://communities.bentley.com/thread/598089?ContentTypeID=1</link><pubDate>Tue, 14 Jul 2020 16:13:42 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:3fd5fd09-0cdc-4524-aa8c-d04edfa8a050</guid><dc:creator>Jan Šlegr</dc:creator><description>[quote userid="91013" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200313/openbuildings-vba-sheetnumber-model-property/598087"]the sheet number[/quote]
&lt;p&gt;Because of confusing naming (different in GUI and in API), I recommend to post picture what &amp;quot;sheet number&amp;quot; do you mean.&lt;/p&gt;
[quote userid="91013" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200313/openbuildings-vba-sheetnumber-model-property/598087"]is part of a different definition in OpenBuilding[/quote]
&lt;p&gt;It cannot be, but I guess only the picture (I have not OBD installed) can confirm you mean &amp;quot;sheet number&amp;quot; from MicroStation and not &amp;quot;sheet number&amp;quot; used by OBD in different context. But I do not think it&amp;#39;s the case.&lt;/p&gt;
[quote userid="91013" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200313/openbuildings-vba-sheetnumber-model-property/598087"]Notice the debugger highlighted &amp;quot;.SheetNumber&amp;quot; as the error.[/quote]
&lt;p&gt;Of course it does. As Jon wrote, sheet number (as well as all other sheet properties) &lt;em&gt;&lt;span style="text-decoration:underline;"&gt;is not part&lt;/span&gt;&lt;/em&gt; of model data structure. It means you cannot access properties like sheet number, sheet name etc. using model reference (it just not makes sense). The right way, as demonstrated in my code, is to obtain SheetDefinition object at first.&lt;/p&gt;
[quote userid="91013" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200313/openbuildings-vba-sheetnumber-model-property/598087"]Maybe this is a glitch in the version of OpenBuilding that I&amp;#39;m using[/quote]
&lt;p&gt;I am pretty sure it&amp;#39;s not.&lt;/p&gt;
&lt;p&gt;Why do you not try my code, extract SheetDefinition, to change SheetName property (displayed as &amp;quot;Sheet number&amp;quot; in GUI) in this object and to assign it back to the model?&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><item><title>RE: OpenBuildings VBA SheetNumber Model Property</title><link>https://communities.bentley.com/thread/598087?ContentTypeID=1</link><pubDate>Tue, 14 Jul 2020 16:07:31 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:d7e0088b-64d6-4dac-982d-b201f012d262</guid><dc:creator>Amador Ontiveros</dc:creator><description>&lt;p&gt;Thank you for your reply Jan! I understand what you&amp;#39;ve presented but I&amp;#39;m starting to think the sheet number is part of a different definition in OpenBuilding. Notice the debugger highlighted &amp;quot;.SheetNumber&amp;quot; as the error.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/343173/SheetNumber.JPG" /&gt;&lt;/p&gt;
&lt;p&gt;the debug highlights a part of the code that seems correct so I checked all the options for &amp;quot;MyModel&amp;quot; and notice &amp;quot;SheetNumber&amp;quot; is not included.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/343173/SheetNumberOption.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Maybe this is a glitch in the version of OpenBuilding that I&amp;#39;m using, as my company has not upgraded to the latest build.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OpenBuildings VBA SheetNumber Model Property</title><link>https://communities.bentley.com/thread/598083?ContentTypeID=1</link><pubDate>Tue, 14 Jul 2020 15:47:30 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:992fb042-832a-4a56-8def-3ab54831b0d8</guid><dc:creator>Amador Ontiveros</dc:creator><description>&lt;p&gt;Hi Jon, MyModel is declared as follows&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Dim MyModel As ModelReference
Dim MySheetDef As SheetDefinition
Set MyModel = ActiveModelReference
Set MySheetDef = MyModel.GetSheetDefinition
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OpenBuildings VBA SheetNumber Model Property</title><link>https://communities.bentley.com/thread/598082?ContentTypeID=1</link><pubDate>Tue, 14 Jul 2020 15:42:16 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:bd8ee613-ca10-480a-8a27-0f1552d9005c</guid><dc:creator>Jan Šlegr</dc:creator><description>&lt;p&gt;Hi Amador,&lt;/p&gt;
[quote userid="91013" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200313/openbuildings-vba-sheetnumber-model-property"]I&amp;#39;ve set up a search criteria to scan all my tags in my drawing[/quote]
&lt;p&gt;Not important for the discussion how to change the sheet parameters ;-)&lt;/p&gt;
[quote userid="91013" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200313/openbuildings-vba-sheetnumber-model-property"]Another odd thing is if I type &amp;quot;sheetnumber&amp;quot;[/quote]
&lt;p&gt;API naming and MicroStation GUI are different, I assume because of history and MicroStation features development. It can be confusing, but right &amp;quot;mapping&amp;quot; can be found easily.&lt;/p&gt;
[quote userid="91013" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200313/openbuildings-vba-sheetnumber-model-property"]Any help would be much appreciated.[/quote]
&lt;p&gt;This should work:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Public Sub ChangeSheetParams()

    If ActiveModelReference.Type &amp;lt;&amp;gt; msdModelTypeSheet Then
        Exit Sub
    End If
    
    Dim sheetDef As SheetDefinition
    Set sheetDef = ActiveModelReference.GetSheetDefinition
    
    &amp;#39; Set sheet number
    sheetDef.SheetName = &amp;quot;Whatever number&amp;quot;
    
    &amp;#39; Set sequence number
    sheetDef.SheetNumber = 9999
    
    &amp;#39; Save changes back to the sheet definition
    ActiveModelReference.SetSheetDefinition sheetDef
    
End Sub&lt;/pre&gt;&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><item><title>RE: OpenBuildings VBA SheetNumber Model Property</title><link>https://communities.bentley.com/thread/598081?ContentTypeID=1</link><pubDate>Tue, 14 Jul 2020 15:40:30 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:fa83c068-1a49-4785-8d92-3ee3af4a44ce</guid><dc:creator>Jon Summers</dc:creator><description>&lt;p&gt;&lt;code&gt;SheetNumber&lt;/code&gt; isn&amp;#39;t part of the MicroStation VBA &lt;code&gt;ModelReference&lt;/code&gt; class, but it is part of the &lt;code&gt;SheetDefinition&lt;/code&gt; class.&amp;nbsp; How is your variable &lt;code&gt;MyModel&lt;/code&gt; declared?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>