not sure why you're instantiating then killing then shelling the mapinfo
object.  it's effectively the same as opening mapinfo twice, then closing
down the first one.  actually, you may find that you have two mapinfo's open
when doing that.  check your TASK MANAGER to see whether you have multiple
MAPINFOW.EXE's eating up your resources.  i remember from the pre MI 7 days
that dimming the object as a generic object rather than a
MapInfo.Application had some erratic effects that took a lot of error
trapping and checking to ensure everything was valid.

after your createobject line you could just...

#######################
MapInfo.Visible = True
MapInfo.Do "Run Application " & Chr$(34) & Imef & Chr$(34)
#######################

this should have the same effect... off the top of my head.

i'm assuming this isn't an integrated mapping application, just perhaps a
button on a form which is supposed to fire up mapinfo based on a werkspace
name listed in a text box or something?

if you wanted to maintain a reference to the mapinfo object throughout your
application you could just omit the unsetting of the MapInfo object until
your app closes.  as long as it's a public variable, you'll be able to have
other stuff in your app play with mapinfo too.

but if that's the extent of what you wanted to achieve with this, then leave
your code as is, coz it werks.

-----Original Message-----
From: Jure Ravnik [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 9 July 2003 6:36 PM
To: Mapinfo List
Subject: MI-L Solution to opening a workspace with VB


Hi,
special thanks to Laurence and Robert.
With their help I've managed to write this:

Dim PotDoMi As String    
Dim Mapinfo As Object
Dim imef as String      

imef="C:\test.wor"
Set Mapinfo = CreateObject("MapInfo.Application")
PotDoMi = Mapinfo.eval("programdirectory$()")
Set Mapinfo = Nothing
MyAppID = Shell(PotDoMi & "\Mapinfow.exe " & imef, 1)  ' Run Mapinfo.
AppActivate MyAppID   ' Activate Mapinfo.

which starts Mapinfo and loads the Test.wor workspace.

Thank you
 Jure.

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 7552

Reply via email to