I have created this routin.
Dim oElement As Element Dim ElemId As DLong Dim Id As String Dim Regel As String Dim oEnumerator As ElementEnumerator Dim oScanCriteria As New ElementScanCriteria oScanCriteria.ExcludeAllTypes oScanCriteria.IncludeType msdElementTypeLine oScanCriteria.IncludeType msdElementTypeArc 'oScanCriteria.IncludeType msdElementTypeText 'oScanCriteria.ExcludeAllColors 'oScanCriteria.IncludeColor 0 counter = 0 counter2 = 0 counter3 = 0 Open "H:/temp/element.txt" For Output As #1 Set oEnumerator = ActiveModelReference.Scan(oScanCriteria) Do While oEnumerator.MoveNext Set oElement = oEnumerator.Current If oElement.Type = msdElementTypeLine Then counter2 = counter2 + 1 ElemId = oElement.Id 'Regel = oElement.GetExtractlinkage Id = DLongToString(ElemId) Print #1, Id & regel ElseIf oElement.Type = msdElementTypeArc Then counter = counter + 1 End If counter3 = counter3 + 1 Loop Close #1 MsgBox "The total number of elements scanned were: " & CStr(counter3) & ":" & CStr(counter2) & ":" & CStr(counter) End Sub
now i want to get som user data from a element. when i use microstation basic the commant for it is:
Function locate_isElementAcceptable (elem as MbeElement,regel as String) as Integer regel$=space$(80) If elem.type = MBE_Text or elem.type = MBE_LineString or _ elem.type = MBE_Line or elem.type = MBE_Arc or _ elem.type = 2 or elem.type=15 Then status=elem.extractLinkage(regel, 19276) If status <> Mbe_Success Then exit function Else regel="GEEN FUNCTIE" ' MbeSendKeyin "beep" exit function End If locate_isElementAcceptable = TRUE End Function
but this is not working in VBA. i want to get this "status=elem.extractLinkage" working in my routin
Hi okkie,
can you please edit your post and to reinsert the code using Syntax highlighter tool (yellow pencil icon), so it will be nicely formatted and easier to be read?
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Not exactly. Check e.g. this thread how code is displayed when inserted using Syntax highlighter and set as VBA code.
Regarding to your code: What you posted is MicroStation BASIC code, which of course cannot work in VBA (one from reasons is there is nothing like MbeElement). So is your question "How to rewrite my BASIC macro into VBA." or "I have VBA code and it doesn't work?".
Regards,
mark anderson [Bentley]
Visit me at https://communities.bentley.com/communities/other_communities/bentley_innovation/default.aspx
Answer Verified By: Robert Hook