<?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>[VBA] Need help with MDL Wrapper Function for mdlSheetDef_setBorderAttachmentId</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/92695/vba-need-help-with-mdl-wrapper-function-for-mdlsheetdef_setborderattachmentid</link><description>The documentation when followed generates the following error message: 
 Bad DLL calling convention (Error 49) 
 While this error has a help page, it does not explain any specific corrective action that can be done. 
 The Wrapper statement, from the</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: [VBA] Need help with MDL Wrapper Function for mdlSheetDef_setBorderAttachmentId</title><link>https://communities.bentley.com/thread/270301?ContentTypeID=1</link><pubDate>Fri, 20 Dec 2013 12:02:01 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:a8594177-b6f6-4750-bb33-0320c48654fb</guid><dc:creator>caddcop</dc:creator><description>&lt;p&gt;Jon,&lt;/p&gt;
&lt;p&gt;You &amp;quot;Da Man!&amp;quot;&lt;/p&gt;
&lt;p&gt;Worked a treat!&lt;/p&gt;
&lt;p&gt;You really earned your BeMVP star today!&lt;/p&gt;
&lt;p&gt;Here is the code: (Note - At this time, it is essential to modify a number of fixed values and strings for this to function. I also had to change the slot number of my reference files, which can be done in the reference file dialog box. But it was also necessary to close and reopen the file for this to work. Next on the agenda is for the code to try and determine which slot contains the sheet border and work its magic based upon what it finds so no fixed values are required. As for the slot number issue, In my anticipated work flow, InRoads creates the model with the attached border and I believe, it is always in slot 1. And in that workflow, all sizes and annotation scales will be identical.) &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sub changeModelType2Sheet()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Dim thisModel As ModelReference, refBorder As ModelReference&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Dim thisSheet As SheetDefinition&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Dim refBorderElID As DLong&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Dim sheetDefRef As Long&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Set thisModel = ActiveModelReference&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Set refBorder = ActiveModelReference.Attachments(1)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;If thisModel.Type &amp;lt;&amp;gt; msdModelTypeSheet Then thisModel.Type = msdModelTypeSheet&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;refBorderElID = refBorder.AsAttachment.ElementID&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Set thisSheet = thisModel.GetSheetDefinition&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;With thisSheet&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sheetDefRef = VarPtr(.MdlSheetDef)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#39;this next line actually does not work&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.FormName = &amp;quot;Arch D&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#39;these next two lines result in a correct FormName if there is a FormName defined with a matching size&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.Width = thisModel.WorkingUnitsToDouble(&amp;quot;36&amp;#39;&amp;quot;) * thisModel.UORsPerMasterUnit&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.Height = thisModel.WorkingUnitsToDouble(&amp;quot;24&amp;#39;&amp;quot;) * thisModel.UORsPerMasterUnit&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.AnnotationScaleFactor = 30&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End With&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;expr = &amp;quot;mdlSheetDef_setBorderAttachmentId((void*)&amp;quot; &amp;amp; thisSheet.MdlSheetDef &amp;amp; &amp;quot;, &amp;quot; &amp;amp; _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DLongToString(refBorderElID) &amp;amp; &amp;quot;)&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;GetCExpressionValue expr&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;thisModel.SetSheetDefinition thisSheet&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;thisModel.PropagateAnnotationScale&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [VBA] Need help with MDL Wrapper Function for mdlSheetDef_setBorderAttachmentId</title><link>https://communities.bentley.com/thread/269788?ContentTypeID=1</link><pubDate>Mon, 16 Dec 2013 15:00:00 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:0775125c-5e27-4f57-9db0-9bbb6bb52579</guid><dc:creator>Jon Summers</dc:creator><description>&lt;p&gt;[quote user=&amp;quot;caddcop&amp;quot;]Can I change &lt;span style="font-family:terminal,monaco;"&gt;DLongToString(id)&lt;/span&gt; to &lt;span style="font-family:terminal,monaco;"&gt;DLongToString(refBorderElID)?&lt;/span&gt;[/quote]&lt;/p&gt;
&lt;p&gt;Yes, noting John Gooding&amp;#39;s warning.&amp;nbsp; As a work-around it will do until this gets fixed in a future version of MicroStation VBA.&amp;nbsp; It should be some time before you use up the first two billion element IDs.&lt;/p&gt;
&lt;p&gt;[quote user=&amp;quot;caddcop&amp;quot;]What syntax can I use to put my &lt;span style="font-family:terminal,monaco;"&gt;thisSheet&lt;/span&gt; which contains my &lt;span style="font-family:terminal,monaco;"&gt;SheetDefinition&lt;/span&gt; already, into the &lt;span style="font-family:terminal,monaco;"&gt;expr&lt;/span&gt;[/quote]&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#008000;"&gt;&amp;#39; Retrieves the associated SheetDef pointer that a program can use as an argument to MDL mdlSheetDef functions&lt;/span&gt;&lt;br /&gt; &lt;span style="font-family:courier new,courier;"&gt;thisSheet.MdlSheetDef&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [VBA] Need help with MDL Wrapper Function for mdlSheetDef_setBorderAttachmentId</title><link>https://communities.bentley.com/thread/269773?ContentTypeID=1</link><pubDate>Mon, 16 Dec 2013 13:18:54 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:2a0be020-4c5f-4b79-ba7f-fee24cc6c716</guid><dc:creator>caddcop</dc:creator><description>&lt;p&gt;Bump!&lt;/p&gt;
&lt;p&gt;I&amp;#39;m getting close, but need a little more help. See my last post - two questions at the bottom.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: [VBA] Need help with MDL Wrapper Function for mdlSheetDef_setBorderAttachmentId</title><link>https://communities.bentley.com/thread/269295?ContentTypeID=1</link><pubDate>Tue, 10 Dec 2013 19:07:33 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:3068e0f6-f351-44a5-b1cc-a8185a1fe8f1</guid><dc:creator>caddcop</dc:creator><description>&lt;p&gt;OK, this is my code from the earlier post:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;span style="font-family:terminal,monaco;"&gt;Sub changeModelType2Sheet()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim thisModel As ModelReference, refBorder As ModelReference&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim thisSheet As SheetDefinition&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim refBorderElID As DLong&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&lt;span style="font-family:terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set thisModel = ActiveModelReference&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:terminal,monaco;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Assume 1st reference file slot for now&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set refBorder = ActiveModelReference.Attachments(1)&lt;br /&gt;&lt;span style="color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; This next line changes the model type to a sheet&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; thisModel.Type = msdModelTypeSheet&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:terminal,monaco;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; This appears to read the element ID of the 1st reference file &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; refBorderElID = refBorder.AsAttachment.ElementID&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set thisSheet = thisModel.GetSheetDefinition&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; With thisSheet&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:terminal,monaco;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;This code fails to set the sheet size.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .FormName = &amp;quot;ANSI D&amp;quot;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:terminal,monaco;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;However, this code will cause the ANSI D sheet site&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;to be set as the form name&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:terminal,monaco;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;It took some trial and error to develop this result.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;VBA Help was no help&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Width = thisModel.WorkingUnitsToDouble(&amp;quot;34&amp;#39;&amp;quot;) * 1000&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Height = thisModel.WorkingUnitsToDouble(&amp;quot;22&amp;#39;&amp;quot;) * 1000&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .AnnotationScaleFactor = 10&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:terminal,monaco;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;This next code will throw the error. Comment it out and most &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;everything else works.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mdlSheetDef_setBorderAttachmentId thisSheet, refBorderElID&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:terminal,monaco;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End With&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:terminal,monaco;"&gt;End Sub&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;When It go to modify this, I will be replacing my code:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;span style="font-family:terminal,monaco;"&gt;mdlSheetDef_setBorderAttachmentId thisSheet, refBorderElID&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;with some version of this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;expr = &amp;quot;mdlSheetDef_setBorderAttachmentId((void*)&amp;quot; &amp;amp; theAddr &amp;amp; &amp;quot;, &amp;quot; &amp;amp; _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DLongToString(id) &amp;amp; &amp;quot;)&amp;quot;&lt;br /&gt;GetCExpressionValue expr&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;As I understand your example, &lt;span style="font-family:terminal,monaco;"&gt;theAddr&lt;/span&gt; is the address of the sheet definition(?) and &lt;span style="font-family:terminal,monaco;"&gt;id&lt;/span&gt; is the DLong containing the element ID of the model Reference that contains the sheet border.&lt;/p&gt;
&lt;p&gt;My code appears to successfully retrieve the element ID as the Sheet Definition (address of ... ?)&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;So, can I change &lt;span style="font-family:terminal,monaco;"&gt;DLongToString(id)&lt;/span&gt; to &lt;span style="font-family:terminal,monaco;"&gt;DLongToString(refBorderElID)&lt;/span&gt; and skip using the &lt;span style="color:#000000;"&gt;code &lt;span style="font-family:terminal,monaco;"&gt; id.Low = 1111&lt;span style="font-family:arial,helvetica,sans-serif;"&gt; since I have the correct value in my DLong already?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;span style="color:#000000;"&gt;And if that is OK, what syntax can I use to put my &lt;span style="font-family:terminal,monaco;"&gt;thisSheet&lt;/span&gt; which contains my &lt;span style="font-family:terminal,monaco;"&gt;SheetDefinition&lt;/span&gt; already, into the &lt;span style="font-family:terminal,monaco;"&gt;expr&lt;/span&gt; line of code?&lt;/span&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span style="color:#000000;"&gt;TIA&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: [VBA] Need help with MDL Wrapper Function for mdlSheetDef_setBorderAttachmentId</title><link>https://communities.bentley.com/thread/269013?ContentTypeID=1</link><pubDate>Sat, 07 Dec 2013 02:41:38 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:7ca58843-3081-4b68-92d1-f80d25525d50</guid><dc:creator>John Gooding</dc:creator><description>&lt;p&gt;I&amp;#39;m sorry to say the wrapper function matches the documentation. &amp;nbsp;The wrapper function requires an ElementId passed by value but VBA does not support it. The only way to pass the element ID to the wrapped function is to use the CExpression support. &amp;nbsp;For example,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; Dim theAddr As Long&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim id As DLong&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; id.Low = 1111&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; expr = &amp;quot;mdlSheetDef_setBorderAttachmentId((void*)&amp;quot; &amp;amp; theAddr &amp;amp; &amp;quot;, &amp;quot; &amp;amp; DLongToString(id) &amp;amp; &amp;quot;)&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GetCExpressionValue expr&lt;/p&gt;
&lt;p&gt;The CExpression scanner only supports 32-bit integers so this only supports element ID&amp;#39;s up to&amp;nbsp;2147483647. &amp;nbsp;I don&amp;#39;t think that is a problem as it takes a long time to go through 2 billion element ID&amp;#39;s.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;John Gooding&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: [VBA] Need help with MDL Wrapper Function for mdlSheetDef_setBorderAttachmentId</title><link>https://communities.bentley.com/thread/269011?ContentTypeID=1</link><pubDate>Sat, 07 Dec 2013 02:23:18 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:b7eb23ce-6297-4f30-a3f2-c4c87c570e81</guid><dc:creator>Robert Hook</dc:creator><description>&lt;p&gt;Jon - I will file a bug report on &lt;em&gt;mdlSheetDef_setBorderAttachmentId&lt;/em&gt;, thank you for pointing this out.&lt;/p&gt;
&lt;p&gt;Charles - Although you could call &lt;em&gt;mdlSheetDef_setBorderAttachmentId&lt;/em&gt; with CExpression similar to Item 1 below, your original question was on &lt;em&gt;mdlSheetDef_getBorderAttachmentId&lt;/em&gt;.&amp;nbsp; Once you had the Sheet ID, what were you&amp;nbsp;going&amp;nbsp;to do with it after?&amp;nbsp; The reason I ask is if your end goal is to get/set the ModelReference Sheet Properties, than you could do so&amp;nbsp;using the ModelReference Object directly, or via the Properties of the ModelReference Object via &lt;em&gt;CreatePropertyHander&lt;/em&gt; using the current MdlSheetDef.&amp;nbsp; See Item 2&amp;nbsp;below.&lt;/p&gt;
&lt;p&gt;Thank you,&lt;br /&gt;Bob&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;This is a sample setting a border attachment id:&lt;br /&gt;&lt;br /&gt;Dim theAddr As Long&lt;br /&gt;Dim id As DLong&lt;br /&gt;id.Low = 1111&lt;br /&gt;expr = &amp;quot;mdlSheetDef_setBorderAttachmentId((void*)&amp;quot; &amp;amp; theAddr &amp;amp; &amp;quot;, &amp;quot; &amp;amp; DLongToString(id) &amp;amp; &amp;quot;)&amp;quot;&lt;br /&gt;GetCExpressionValue expr&lt;/li&gt;
&lt;li&gt;This is a sample of SheetDefinition properties that you can get/set using - ModelRef Object and Properties&lt;br /&gt;&lt;br /&gt;ModelReference Object:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Model Name: ModelSheetName&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Model Type: msdModelTypeSheet&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MasterUnit.Base: 1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MasterUnit.Label: in&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MasterUnit.System: msdMeasurementSystemEnglish&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MasterUnit.UnitsPerBaseDenominator: 254&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MasterUnit.UnitsPerBaseNumerator: 10000&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; StorageUnit.Base: 1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; StorageUnit.Label: &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; StorageUnit.System: msdMeasurementSystemEnglish&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; StorageUnit.UnitsPerBaseDenominator: 254&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; StorageUnit.UnitsPerBaseNumerator: 10000&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SubUnit.Base: 1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SubUnit.Label: th&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SubUnit.System: msdMeasurementSystemEnglish&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SubUnit.UnitsPerBaseDenominator: 254&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SubUnit.UnitsPerBaseNumerator: 100000&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; UORsPerMasterUnit: 1000000&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; UORsPerStorageUnit: 1000000&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; UORsPerSubUnit: 100000&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ================================================================================&lt;br /&gt;ModelReference Object Properties:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [ModelReference] object id (N/A) has (17) defined properties: &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [1] Name: ModelSheetName&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [2] Type: 1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [3] IsActive: True&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [4] Is3D: False&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [5] TreatAs3D: False&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [6] CellType: 0&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [7] Description: ModelSheetDescr&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [8] DefaultRefLogical: ModelSheetLogicalName&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [9] PropagateAnnotationScale: True&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [10] AnnotationScale: 6000&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [11] IsEnabled: True&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [12] SheetOrigin: 10.0000in, 10.0000in&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [13] SheetWidth: 11&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [14] SheetHeight: 8.5&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [15] SheetRotation: 0.785398163397448&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [16] SheetNumber: 10&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [17] SheetName: PropertiesSheetName&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: [VBA] Need help with MDL Wrapper Function for mdlSheetDef_setBorderAttachmentId</title><link>https://communities.bentley.com/thread/268937?ContentTypeID=1</link><pubDate>Fri, 06 Dec 2013 14:57:43 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:8adf798d-392e-4bd7-b422-335d8d8cb6f5</guid><dc:creator>Jon Summers</dc:creator><description>&lt;p&gt;[quote user=&amp;quot;Yongan.Fu&amp;quot;]ElementID is not a structure, it is just a base type __int64[/quote]&lt;/p&gt;
&lt;p&gt;Correct &amp;mdash; but only for MDL and C++, which support the &lt;span style="font-family:courier new,courier;"&gt;__int64&lt;/span&gt; data type. Microsoft invented VBA before 64-bit processors existed and does not support the 64-bit integer data type, which is why Bentley Systems invented the DLong UDT. MDL&amp;#39;s &lt;span style="font-family:courier new,courier;"&gt;ElementID&lt;/span&gt; is an alias for &lt;span style="font-family:courier new,courier;"&gt;__int64&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;The problem is this&amp;nbsp;&amp;hellip;&lt;/p&gt;
&lt;pre&gt;&lt;code style="font-family:courier new,courier;"&gt; ElementID id = 0;&lt;br /&gt; mdlSheetDef_getBorderAttachmentId (..., &amp;amp;id);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the above fragment, the variable that contains the element ID (a 64-bit number) is passed by address. C/C++ languages can modify the contents of an address. It&amp;#39;s the equivalent of VBA &lt;span style="font-family:courier new,courier;"&gt;ByRef&lt;/span&gt;. However, because VBA can&amp;#39;t cope with 64-bit integers, we have to use the &lt;span style="font-family:courier new,courier;"&gt;DLong&lt;/span&gt; UDT. In this case the MDL wrapper declaration fo the &lt;em&gt;getter&lt;/em&gt; function from MDL help is correct&amp;nbsp;&amp;hellip;&lt;/p&gt;
&lt;pre&gt;&lt;code style="font-family:courier new,courier;"&gt;Declare Function mdlSheetDef_getBorderAttachmentId _&lt;br /&gt; &amp;nbsp;&amp;nbsp; Lib &amp;quot;stdmdlbltin.dll&amp;quot; ( _&lt;br /&gt; &amp;nbsp;&amp;nbsp; ByVal sheetDefIn As Long , _&lt;br /&gt; &amp;nbsp;&amp;nbsp; ByRef borderAttachmentIdOut As DLong ) As Long&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The MDL wrapper for the &lt;em&gt;setter&lt;/em&gt; function is incorrect, because it wants to pass a &lt;span style="font-family:courier new,courier;"&gt;DLong&lt;/span&gt; by value&amp;nbsp;&amp;hellip;&lt;/p&gt;
&lt;pre&gt;&lt;code style="font-family:courier new,courier;"&gt;Declare Function mdlSheetDef_setBorderAttachmentId _&lt;br /&gt; Lib &amp;quot;stdmdlbltin.dll&amp;quot; ( _&lt;br /&gt; ByVal sheetDefIn As Long , _&lt;br /&gt; &lt;span style="background-color:#ffff00;"&gt;ByVal&lt;/span&gt; borderAttachmentIdIn As DLong ) As Long&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We can edit that declaration so that VBA will parse it correctly&amp;nbsp;&amp;hellip;&lt;/p&gt;
&lt;pre&gt;&lt;code style="font-family:courier new,courier;"&gt;Declare Function mdlSheetDef_setBorderAttachmentId _&lt;br /&gt; Lib &amp;quot;stdmdlbltin.dll&amp;quot; ( _&lt;br /&gt; ByVal sheetDefIn As Long , _&lt;br /&gt; &lt;span style="background-color:#ffff00;"&gt;ByRef&lt;/span&gt; borderAttachmentIdIn As DLong ) As Long&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;However, changing that declaration does not change the underlying code. We don&amp;#39;t know how that MDL wrapper is implemented. I suspect that there may be some internal confusion in the conversion from the internal &lt;span style="font-family:courier new,courier;"&gt;__int64&lt;/span&gt; and the VBA &lt;span style="font-family:courier new,courier;"&gt;DLong&lt;/span&gt; passed by address.&lt;/p&gt;
&lt;!-- signoff --&gt;
&lt;p&gt;Regards, Jon Summers &lt;br /&gt; &lt;a href="http://www.la-solutions.co.uk"&gt;LA Solutions&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: [VBA] Need help with MDL Wrapper Function for mdlSheetDef_setBorderAttachmentId</title><link>https://communities.bentley.com/thread/268928?ContentTypeID=1</link><pubDate>Fri, 06 Dec 2013 14:35:32 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:82ad4941-9ce3-4a6f-9ff5-818eaf5551a3</guid><dc:creator>Yongan.Fu</dc:creator><description>&lt;p&gt;Hi Jon,&lt;/p&gt;
&lt;p&gt;I have a mistyping. I want to type&lt;/p&gt;
&lt;p&gt;Using declaration &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;ByRef&lt;/span&gt; borderAttachmentId As DLong&lt;/strong&gt; is ok for&amp;nbsp; mdlSheetDef_getBorderAttachmentId because its second parameter&amp;#39;s&amp;nbsp;C declaration is &lt;strong&gt;ElementID *&lt;/strong&gt; (a pointer to a structure. acutually ElementID is not a structure, it is just a base type __int64) but not ok for mdlSheetDef_setBorderAttachmentId because its second parameter&amp;#39;s delcaration is &lt;strong&gt;ElementID&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Thank you, YongAn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: [VBA] Need help with MDL Wrapper Function for mdlSheetDef_setBorderAttachmentId</title><link>https://communities.bentley.com/thread/268910?ContentTypeID=1</link><pubDate>Fri, 06 Dec 2013 12:49:15 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:3f7e099b-2f70-4ec2-8055-3e34b46c0b88</guid><dc:creator>Jon Summers</dc:creator><description>&lt;p&gt;[quote user=&amp;quot;Yongan.Fu&amp;quot;]It&amp;#39;s my fault[/quote]&lt;/p&gt;
&lt;p&gt;It&amp;#39;s not your fault.&amp;nbsp; This question has come up before.&amp;nbsp; The MDL document generator is an automatic process, that occasionally makes mistakes.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can&amp;#39;t pass a UDT &lt;span style="font-family:courier new,courier;"&gt;ByVal&lt;/span&gt;; it must be &lt;span style="font-family:courier new,courier;"&gt;ByRef&lt;/span&gt; &amp;mdash; that&amp;#39;s the way VB/VBA works.&amp;nbsp; From the C programmer&amp;#39;s viewpoint, &lt;span style="font-family:courier new,courier;"&gt;ByRef&lt;/span&gt; means &lt;em&gt;pointer&lt;/em&gt;.&amp;nbsp; I guess Microsoft decided that they wanted to eliminate the possibility of passing a potentially huge chunk of data on the stack (MDL does exactly the same thing &amp;mdash; &lt;span style="font-family:courier new,courier;"&gt;struct&lt;/span&gt;s are always passed by address).&amp;nbsp; Both &lt;em&gt;set&lt;/em&gt; and &lt;em&gt;get&lt;/em&gt; functions must pass a UDT &lt;span style="font-family:courier new,courier;"&gt;ByRef&lt;/span&gt;, even though the &lt;em&gt;get&lt;/em&gt; function is not modifying the variable.&lt;/p&gt;
&lt;p&gt;It&amp;#39;s easy to test.&amp;nbsp; Write a couple of functions that take a Point3d.&amp;nbsp; Then see which compiles successfully&amp;nbsp;&amp;hellip;&lt;/p&gt;
&lt;pre&gt;&lt;code style="font-family:courier new,courier;"&gt;&lt;span style="color:seagreen;"&gt; &amp;#39; Point3d is a Bentley-defined User Defined Type (UDT)&lt;/span&gt;&lt;br /&gt; Sub TestUDT1 (ByVal p As Point3d)&lt;br /&gt; &amp;nbsp;&amp;nbsp; &lt;span style="color:seagreen;"&gt;&amp;#39; ...&lt;/span&gt;&lt;br /&gt; End Sub&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style="font-family:courier new,courier;"&gt; Sub TestUDT2 (ByRef p As Point3d)&lt;br /&gt; &amp;nbsp;&amp;nbsp; &lt;span style="color:seagreen;"&gt;&amp;#39; ...&lt;/span&gt;&lt;br /&gt; End Sub&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style="font-family:courier new,courier;"&gt;&lt;span style="color:seagreen;"&gt; &amp;#39; VBA&amp;#39;s default calling convention is ByRef&lt;/span&gt;&lt;br /&gt; Sub TestUDT3 (p As Point3d)&lt;br /&gt; &amp;nbsp;&amp;nbsp; &lt;span style="color:seagreen;"&gt;&amp;#39; ...&lt;/span&gt;&lt;br /&gt; End Sub&lt;/code&gt;&lt;/pre&gt;
&lt;!-- signoff --&gt;
&lt;p&gt;Regards, Jon Summers &lt;br /&gt; &lt;a href="http://www.la-solutions.co.uk"&gt;LA Solutions&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: [VBA] Need help with MDL Wrapper Function for mdlSheetDef_setBorderAttachmentId</title><link>https://communities.bentley.com/thread/268893?ContentTypeID=1</link><pubDate>Fri, 06 Dec 2013 08:12:20 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:b191e46f-7a6a-4718-b777-2097007f48e4</guid><dc:creator>Yongan.Fu</dc:creator><description>&lt;p&gt;Sorry, it&amp;#39;s my fault (plus doc&amp;#39;s fault).&lt;/p&gt;
&lt;p&gt;In MDL side, mdlSheetDef_getBorderAttachmentId use &lt;strong&gt;ElementID *&lt;/strong&gt; as its second parameter but mdlSheetDef_setBorderAttachmentId use &lt;strong&gt;ElementID&lt;/strong&gt; as it. Using declaration&amp;nbsp;&lt;strong&gt;ByVal borderAttachmentId As DLong&lt;/strong&gt; is ok for &amp;nbsp;mdlSheetDef_getBorderAttachmentId but not ok for mdlSheetDef_setBorderAttachmentId.&lt;/p&gt;
&lt;p&gt;I will investigate this interesting question further and find a Bentley expert to&amp;nbsp;help.&lt;/p&gt;
&lt;p&gt;YongAn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: [VBA] Need help with MDL Wrapper Function for mdlSheetDef_setBorderAttachmentId</title><link>https://communities.bentley.com/thread/268767?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2013 13:35:30 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:04426ee3-e3ec-4175-bf2e-6deaaf6f532c</guid><dc:creator>Jon Summers</dc:creator><description>&lt;p&gt;[quote user=&amp;quot;Yongan.Fu&amp;quot;]Declare Function mdlSheetDef_setBorderAttachmentId Lib &amp;quot;stdmdlbltin.dll&amp;quot; &lt;br /&gt;(ByVal sheetDefIn As Long , &lt;span style="color:#ff6600;"&gt;&lt;strong&gt;ByVal&lt;/strong&gt;&lt;/span&gt; borderAttachmentIdIn As DLong ) As Long [/quote]&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:courier new,courier;"&gt;DLong&lt;/span&gt; is a VBA &lt;em&gt;User Defined Type&lt;/em&gt; (UDT).&amp;nbsp; UDTs must be passed &lt;span style="font-family:courier new,courier;"&gt;ByRef&lt;/span&gt;.&amp;nbsp; The MDL documentation for that VBA wrapper is incorrect.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: [VBA] Need help with MDL Wrapper Function for mdlSheetDef_setBorderAttachmentId</title><link>https://communities.bentley.com/thread/268760?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2013 12:17:51 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:979f5cfc-9197-40a2-b7d5-e4557ccbf029</guid><dc:creator>Yongan.Fu</dc:creator><description>&lt;p&gt;Hi caddcop,&lt;/p&gt;
&lt;p&gt;I wrote below code snippet to demonstrate mdlSheetDef_get[set]BorderAttachmentId functions.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ElementID refId = INVALID_ELEMENTID;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SheetDef* sheetDef = mdlSheetDef_new ();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mdlModelRef_getSheetDef (ACTIVEMODEL, sheetDef);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mdlSheetDef_getBorderAttachmentId (sheetDef, &amp;amp;refId);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (INVALID_ELEMENTID == refId || 0 == refId)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DgnModelRefP&amp;nbsp; modelRef;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (SUCCESS != mdlRefFile_attachCoincident (&amp;amp;modelRef, &amp;quot;d:\\atemp\\border_e.dgn&amp;quot;, L&amp;quot;BORDER_E&amp;quot;, NULL, REF_FILE_LEVEL_DISPLAY_DEFAULT, TRUE, TRUE))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mdlSheetDef_free (&amp;amp;sheetDef);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; refId = mdlRefFile_attachmentIdFromModelRef (modelRef);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mdlSheetDef_setBorderAttachmentId (sheetDef, refId);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mdlModelRef_setSheetDef (ACTIVEMODEL, sheetDef);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mdlSheetDef_free (&amp;amp;sheetDef);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;From it, we can use if (INVALID_ELEMENTID == refId || 0 == refId) to determine if a sheet model exists a border attachment.&lt;/p&gt;
&lt;p&gt;For&amp;nbsp;your VBA wrapper,&amp;nbsp;the thread&amp;nbsp;title asks setBorderAttachmentId but your first post shows getBorderAttachmentId wrapper. So I am not sure if you declare setBorderAttachmentId correctly. From VBA help, we can find following:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Declare Function mdlSheetDef_getBorderAttachmentId Lib &amp;quot;stdmdlbltin.dll&amp;quot; &lt;br /&gt;(ByVal sheetDefIn As Long , &lt;strong&gt;&lt;span style="color:#ff6600;"&gt;ByRef&lt;/span&gt;&lt;/strong&gt; borderAttachmentIdOut As DLong ) As Long &lt;br /&gt;Declare Function mdlSheetDef_setBorderAttachmentId Lib &amp;quot;stdmdlbltin.dll&amp;quot; &lt;br /&gt;(ByVal sheetDefIn As Long , &lt;span style="color:#ff6600;"&gt;&lt;strong&gt;ByVal&lt;/strong&gt;&lt;/span&gt; borderAttachmentIdIn As DLong ) As Long &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;You can notice the different parameter declarations.&lt;/p&gt;
&lt;p&gt;HTH, YongAn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: [VBA] Need help with MDL Wrapper Function for mdlSheetDef_setBorderAttachmentId</title><link>https://communities.bentley.com/thread/268748?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2013 08:27:19 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:08888559-3094-44c3-9cfc-c796b975eea7</guid><dc:creator>caddcop</dc:creator><description>&lt;p&gt;The current InRoads sheet tools can make separate models with referenced in borders. But they are neither sheet models, nor therefore sheet border attachments.&lt;/p&gt;
&lt;p&gt;So manually changing these is time consuming and often, the precess needs to be redone due to design changes.&lt;/p&gt;
&lt;p&gt;The code I have will convert a model to a sheet but the mdl wraper function from the mdl documentation does not work and throw an error.&lt;/p&gt;
&lt;p&gt;If the mdl function works, I need the correct wrapper function or an explanation as to what is not correct in my code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: [VBA] Need help with MDL Wrapper Function for mdlSheetDef_setBorderAttachmentId</title><link>https://communities.bentley.com/thread/268507?ContentTypeID=1</link><pubDate>Tue, 03 Dec 2013 17:56:04 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:ac50a08f-4b5b-4941-9c50-6d0980626986</guid><dc:creator>Jan Šlegr</dc:creator><description>&lt;p&gt;Hi caddcop,&lt;/p&gt;
&lt;p&gt;what do you want to achieve? For an existing sheet to set existing attached reference to be a new border for this sheet?&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: [VBA] Need help with MDL Wrapper Function for mdlSheetDef_setBorderAttachmentId</title><link>https://communities.bentley.com/thread/268503?ContentTypeID=1</link><pubDate>Tue, 03 Dec 2013 17:24:03 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:48a79ac3-fa93-44c2-bdff-3694815b4e0c</guid><dc:creator>caddcop</dc:creator><description>&lt;p&gt;Bump&lt;/p&gt;
&lt;p&gt;We need assistance from a Bentley Colleague! &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: [VBA] Need help with MDL Wrapper Function for mdlSheetDef_setBorderAttachmentId</title><link>https://communities.bentley.com/thread/267257?ContentTypeID=1</link><pubDate>Wed, 20 Nov 2013 17:24:29 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:8f19ab10-12ad-4662-ac9f-7126b14be638</guid><dc:creator>caddcop</dc:creator><description>&lt;p&gt;If I set the border attachment to a reference file, your code returns success. With no border reference, it still returns success but the debug.print statement prints -1 as the ID&lt;/p&gt;
&lt;p&gt;If I then try and use the initial values (when a border reference is assigned) to use the set function vs the get border attachment ID function, it still throws the same error.&lt;/p&gt;
&lt;p&gt;Someone at Bentley clearly needs to research this and determine if there are other arguments or syntax for this to work.&lt;/p&gt;
&lt;p&gt;P.S. I also read the Dlong ID value from both the Attached reference file and the SheetDefAttachmentID and the numbers are the same. That&amp;#39;s a good thing. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: [VBA] Need help with MDL Wrapper Function for mdlSheetDef_setBorderAttachmentId</title><link>https://communities.bentley.com/thread/267253?ContentTypeID=1</link><pubDate>Wed, 20 Nov 2013 16:43:11 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:66e7e30e-b427-4300-969f-a1ff20956922</guid><dc:creator>Jon Summers</dc:creator><description>&lt;p&gt;I guess the approach would something like this&amp;nbsp;&amp;hellip;&lt;/p&gt;
&lt;pre&gt;&lt;code style="font-family:courier new,courier;"&gt; Declare Function mdlSheetDef_getBorderAttachmentId _&lt;br /&gt; &amp;nbsp;&amp;nbsp; Lib &amp;quot;stdmdlbltin.dll&amp;quot; ( _&lt;br /&gt; &amp;nbsp;&amp;nbsp; ByVal sheetDefIn As Long , _&lt;br /&gt; &amp;nbsp;&amp;nbsp; ByRef borderAttachmentIdOut As DLong ) As Long&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style="font-family:courier new,courier;"&gt; Dim oSheetDefinition As SheetDefinition&lt;br /&gt; Set oSheetDefinition = &lt;span style="color:seagreen;"&gt;&amp;#39; ... get Sheet Def from somewhere&lt;/span&gt;&lt;br /&gt; Dim mdlSheetPointer As Long&lt;br /&gt; &lt;span style="color:seagreen;"&gt;&amp;#39; MDL pointer treated as Long in VBA&lt;/span&gt;&lt;br /&gt; mdlSheetPointer = oSheetDefinition.MdlSheetDef &lt;br /&gt; Dim borderAttachmentID As DLong&lt;br /&gt; Const SUCCESS As Long = 0&lt;br /&gt; If SUCCESS = mdlSheetDef_getBorderAttachmentId ( _ &lt;br /&gt; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; mdlSheetPointer, borderAttachmentID) Then&lt;br /&gt; &amp;nbsp;&amp;nbsp; Debug.Print &amp;quot;Sheet Border Attachment ID=&amp;quot; &amp;amp; _ &lt;br /&gt; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; DLongToString (borderAttachmentID)&lt;br /&gt; Else&lt;br /&gt; &amp;nbsp;&amp;nbsp; MsgBox &amp;quot;MDL Function Call Failed&amp;quot;&lt;br /&gt; EndIf&lt;/code&gt;&lt;/pre&gt;
&lt;!-- signoff --&gt;
&lt;p&gt;Regards, Jon Summers &lt;br /&gt; &lt;a href="http://www.la-solutions.co.uk"&gt;LA Solutions&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>