Someone mind helping me with Error 426

I am hoping that someone wouldn't mind helping me out here.

I have a macro in Excel 2003 which I use to modify some data and then put it into MapPoint 2004. I noticed the memory usage for MapPoint jumps up to 175-180 MB when I initialize territories so I decided I would create a subroutine to close the program and then reopen it. Unfortunately MapPoint 2004 does not let you close a file, only the entire program (unless you are using "MapPoint Control" objects but I've already done a significant amount of work using the "MapPoint Application" object). When I tell Mappoint to Quit this causes the remote server to quit and I cannot figure out how to restart it. I want to close the program and re-open it to clear out the memory usage (so an optional method for cleaning up the memory useage would work as well) two times. I can do this once just fine and continue execution of the program but the second time gives me the runtime error 426 which I am unable to get around using the basic information on the msdn (for similar errors in other software). Here is the code that shuts off the server and is called twice in my program:

Private Sub mapcloseopen()
mpmap.Save 'mappoint.map object
filname = mpmap.FullName 'string to store the path and filename of the object to re-open it
MPapp.Quit 'close the application. Mpapp is a MapPoint.Application object
Set MPapp = CreateObject("MapPoint.Application") 'attempt to revive the program
MPapp.OpenMap filname 're-open the map file

End Sub

After MPapp.Quit the "remote server" is closed down according to the variables I am watching and the second time I call this subroutine I get the runtime error 426. Set MPapp = nothing does not clear this up. Thanks for your time.



Answer this question

Someone mind helping me with Error 426

  • Jarret

    Mappoint does not support MDI as far as I can tell. When you open up a second map the previously opened map is closed automatically. You have to open a second instance of mappoint. I have noticed that Mappoint does release the used memory if minimized so I am going to have to see if there is a method or property to minimize the mappoint window to avoid this mess in the first place (When creating territories and adding data on the map the memory usage jumps up to nearly 200MB but minimizing the window and restoring it puts it back down to about 20MB).
  • onesqlguy

    Here are some additional suggestions from our support engineer:

    Hi, about the error 426, I can not find the related documents/description. Could you please tell me the whole error message

    Mappoint does not support MDI, so you should two instances for the two mappoint files.

    If you want to minimize the mappoint window,you should call API FindWindow.

    The sample code should like this http://forum.galahtech.org/index.php showtopic=297&pid=2419&mode=threaded&show=&st=&

    -brenda (ISV Buddy Team)



  • nitinca

    Sorry bud I'm not familiar with Mappoint at all, that was my best educated guess. I did a check to see if what your doing with closing and reopening an application worked and it did, I just visualised what could have been the case with the error message you were getting. Good luck with it though.

  • sunit

    I emulated what you've done with Word and everything works ok, it opens, it closes, it opens again, no problems. So I think you are opening MapPoint ok.

    I think I know what's happening though, error 426 is "Only one MDI Form allowed", when you restart MapPoint there could be a default file containing a MDI form. When you open your map then there will be two MDI forms. Error 426.

    I think you need to close the default MapPoint file before opening your own map.

    Hope that helps.



  • Someone mind helping me with Error 426