Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

RE: Need Assistance in VBA Code

$
0
0

Hi Benjamin,

[quote user="BFrancis"]Am I doing something wrong?[/quote]

I have MicroStation installed only, not AECOsim Building Designer, so I cannot test your code, but it sounds weird. If you call Scan method without ElementScanCriteria, it returns all elements from active model: Both graphic and not graphic elements and in even empty design file there have to be several non graphic elements.

Can you try this simple code with some nearly empty design file?

Public Sub TestElementEnumerator()

Dim oEnumerator As ElementEnumerator

  Set oEnumerator = ActiveModelReference.Scan()

  Do While oEnumerator.MoveNext
    MsgBox "Type: " & oEnumerator.Current.Type
  Loop

End Sub

My another advice (not related directly to the discussed issue) is to always start a code with Option Explicit to ensure VBA will require to declare all variables explicitly, which decrease a thread of unwanted type or another mistake in the variable names.

With regards,

  Jan


Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>