0

I have a Microstation macro that reads the reference files in the current drawing and then prints them to a text file. We are working on getting this running for the new Microstation v8i (upgrade from v8). The macro normally runs through each reference file (from index = 1 to MbeRefFiles.maxRefFiles) and finds the active reference for output.

Now instead, it keeps throwing an Object variable not Set error when referencing the MbeRefFiles(index) object. I'm just doing a Set refFile = MbeRefFiles(index) and it says MbeRefFiles isn't set, which doesn't make sense because it doesn't need to be set. The macro is completely unchanged and has been working for years, and now suddenly it can't read the reference file object. Anyone have any insights?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
jnw
  • 1
  • "Object variable not Set" means that you're referencing an object variable which has not been "set" to an actual object. If you test you'll likely find that MbeRefFiles Is Nothing. If you show some actual code someone might have suggestions as to what the problem might be. – Tim Williams Aug 16 '11 at 16:35
  • MbeRefFiles is not nothing, as MbeRefFiles.maxRefFiles returns an accurate value. MbeRefFiles isn't even a variable, it is the core object that you can assign to an object variable. I'll try to get some code over here to make things clearer. – jnw Aug 16 '11 at 17:17
  • Then is MbeRefFiles(index) Nothing ? – Tim Williams Aug 16 '11 at 17:33
  • It seems to be, yes. This is what doesn't make sense. It appears as though Microstation BASIC has suffered some software rot due to lack of support. The Bentley forums advised me to port this over to VBA which I will be looking into. – jnw Aug 16 '11 at 17:47

2 Answers2

0

As far as I know, you have to use VBA than you can get more comfortable support.Microstation's VBA is based on Microsoft's engine while MBE is cooked by Bentley.

feelapi
  • 1
  • 3
0

MicroStation BASIC became obsolete in 2001 when Bentley Systems released MicroStation v8.

Prefer to use MicroStation VBA. It fully supports MicroStation V8 where MicroStation BASIC falls short. MbeRefFiles.maxRefFiles is an example of the shortcomings of MicroStation BASIC. MicroStation VBA provides a collection (ModelReference.Attachments) that you can iterate using VBA idioms.

PodHunter
  • 74
  • 4