Hello,
I am using vba code in Excel 2007 to open a dgn file and read some Tag values. Everything is working ok when I use the OpenDesignFile Function, but when I use the OpenDesignFileForProgram Function I get the following error:
Can someone explain to me why it fails when I use the OpenDesignFileForProgram Function?
This is how I am calling the OpenDesignFileForProgram Function in my code:
Set oDgn = oMSApp.OpenDesignFileForProgram(oFolder & "\" & oFile.Name, True)
Thank you,
Gerald Piotrowski
Over the years, several people have had problems when using TagElement.Value in another VBA implementation, such as Excel VBA or Access VBA.
TagElement.Value is of data type Variant. Something is going wrong with the Windows data marshalling between the two processes: Excel and MicroStation. Unfortunately, no one has ever published a solution to the problem; nor has anyone published an analysis of why the problem occurs.
If your code works with OpenDesignFile, then stick with that.
Regards, Jon Summers LA Solutions
Jon,
Thanks for the quick response.
I would prefer to use the OpenDesignFileForProgam since it processes the files faster than OpenDesignFileForProgram.
While searching for a resolution I came across this http://support.microsoft.com/kb/189618. In step 8 they say to put the oWord object variable in front of the function. If I were to try this for the varible that is pointing to my Microstation object, how would I gain access to the TagElement.Value or is that possible?
Thanks,
Gerald,
Have you tried programming this in Microstation and sending all of the data to Excel. I have had problems manipulating microstation elements from Excel. On the other hand I have had some success when i am only sending String, Integer and Double data types from Microstation to Excel or pulling characters out of excel via microstation.
Jason