Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 3 of 3

MPControl embedded in excel - excel loses functionality

This is a discussion on MPControl embedded in excel - excel loses functionality within the MapPoint Desktop Discussion forums, part of the Map Forums category; Sorry for all the questions but it seems there isn't much literature on-line about embedding Map Point into excel, so ...

  1. #1
    ruyasan is offline Junior Member White Belt
    Join Date
    May 2004
    Posts
    4

    MPControl embedded in excel - excel loses functionality

    Sorry for all the questions but it seems there isn't much literature on-line about embedding Map Point into excel, so this is the only place I know of to come for help. I tried searching these forums as well but it looks like nobody ran into my problem so far.


    Basically I have a map point controll embedded into excel. The problem is that once the controll is accessed in any way from VBA, excel seems to "lose focus" and a lot of its features become unavailable.

    Its a little hard to explain, but I shall try to illustrate what is happeing:

    1. I open up my spreadsheet (with the embedded MPControl) and excel is fully functional
    2. I hit a button which calculates a route based on information in some cells. The route is calculated and displayed in the embedded control.
    3. Excel is no longer fully functional. I can still edit the contents of cells but nothing much else works (for Example, validation and Format Cell are grayed out in all the menues - as well as any other functions which affect the way cells work)
    4. I found out that if I select something within the embedded controll (like a city name) and then select something back inside the spreadsheet (like some cell) then everything returns to normal

    The problem is that I cannot replicate step 4 programatically.

    For instance, I have some code that does this at the end of my route calculation function:

    locPickUp.Select
    wksDispatch.Range("A1").Select

    This does not return excel to normal functionality. This is a BIG problem for me because I have a function which ads special validation requirements to a cell based on a route look-up. Since the validation functionality of excel turns off as soon as the map point control is accessed, the program crashed with the message:

    "Automation Error:
    The object involved has disconnected from its clients."


    Now, I am not TOO familiar with the inner workings of MS Office objects, but I'm guessing that while the map point controll is accessed, the object tree for excel is temporarily turned off so that the Map Point object tree can be used instead. So how would I go about letting VBA know that I would like to turn the excel tree back on?

    I'm really REALLY stuck on this - so any help would be infinately apretiated!

  2. #2
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    if it helps, I noticed that excel exhibits similar behavior when one clicks on ANY active X control (such as a plain old command button)

    however, with something like a command button, doing a simple Cells(1,1).Select returns excel to its normal functionality

    this doesn't work with the MP Control

    in other words - it seems that what happens is excel assigns the MPControl focus in a way different from what the Select method provides

    I still don't know how to address this though

    Could anyone at least acknowledge that what I'm writing makes any sesnse at all? Could this be a bug? Can anyone help me in any way what so ever? I've alreay wasted 2 days on this bloody glitch, so ANY suggestion would be apretiated!

  3. #3
    ruyasan is offline Junior Member White Belt
    Join Date
    May 2004
    Posts
    4
    for anyone who got here by way of google, the solution turns out to be to select the worksheet explicitly first, then some cells within it

    for example:

    myMapPointControl.NewMap geoNorthAmerica
    Worksheets(1).Select
    Worksheets(1).Range("A1").Select

    will let you access the MPControl and then restore excel to status quo

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. UDF in Excel
    By Bob Jeffery in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 08-12-2005, 02:38 PM
  2. updating an embedded map in Excel
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 08-26-2004, 01:44 PM
  3. Updating an embedded map in Excel from linked data
    By Matt in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 05-13-2003, 10:27 AM
  4. Extracting to Excel
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 12-13-2002, 11:38 AM
  5. Excel Integration is not available
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 10-24-2002, 08:40 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66