urgent ! help with ole needed

Status
Not open for further replies.

Michael Stark

Usenet Archive
Joined
Aug 3, 2000
Messages
50
Reaction score
0
Hello All

This is first time I try to use OLE to direct MicroStation, when I'm using a

CreateObject("MicroStation.Application")

, I'm getting a new MicroStation but this isn't what I want. I need to get the currently opened MicroStation - I have the name of the designfile. I've tried to do the following

dim msApp as Object
set msApp = getObject ("c:\data\test\test.dgn")

but got only a error message (file- or classname while automation not found(VB6 in german)). Even when I try to complete the statement with the class ("MicroStationDgnFile" or "MicroStation.Application") I only get an error (Objectcreation by ActiveX not possible). (the file exists and when I try the same statement on another filetype (like .jpg) an objekt is returned)

has anybody successfully used the getObject-statement ?
Please help, its very urgent

Michael
 
Hi Michael,
Instead of GetObject, try CreateObject:

Dim msApp As Object
Set msApp = CreateObject("MicroStation.Application") If msApp.MbeDgnInfo.dgnFileName = "" Then MsgBox "MicroStation isn't running. Start MicroStation and try again.", vbOKOnly, "Tree Menu" Else msApp.MbeSendCommand ("rd=c:\data\test\test.dgn") End If Set msApp = Nothing

I've learned that it's not reliable to start MicroStation using any object VB function (although you can use the Shell command to start MicroStation quite reliably, including selecting "proper" workspaces); the above code assumes MicroStation is already running. Also, with the J-VB6-Win2000 combination, MbeSendCommand is required--MbeSendKeyin doesn't work. Setting the object to Nothing is standard housekeeping.

HTH,
Simon

Michael Stark wrote:
Hello All

This is first time I try to use OLE to direct MicroStation, when I'm using a

CreateObject("MicroStation.Application")

, I'm getting a new MicroStation but this isn't what I want. I need to get the currently opened MicroStation - I have the name of the designfile. I've tried to do the following

dim msApp as Object
...
 
Thank you very very much !

It works and shows me even the information I needed (indeed I need not to reload the dgn-file, I need only to test if it is the right).

We came from an application (not ours) outside microstation and need to return to the correct drawing just to pick up some points (coordinates and differences). Try to get the rest by myself, asking you if I have no further idea.

Michael

PS: its difficult to switch from mdl & jmdl to ole (although I did some work in VB)
 
Status
Not open for further replies.

Latest threads

Back
Top