As it turns out, there is another way to obtain information from MapPoint to Excel that is not as well-known.
Mappoint For Excel Code For AnThe VBA code for an Excel UDF is written in a standard module in the Excel VBE and called by entering the function in a formula in a worksheet cell.In order to incorporate MapPoint automation in an Excel UDF, open the Visual Basic Environment (VBE) by using the Alt-F11 keys.![]() The Item(1) property returns the best choice based on the available information. It might be also advantageous to set the MapPoint objects to nothing in order to remove them from memory. This writer does not know of another example where an Excel UDF modifies another application. This unusual behavior serendipitously provides a simple way to generate route maps from Excel. If the following formula is entered without the objMap.Saved True statement in the code, the route map from Houston to Dallas is generated and can be saved. Thus, generation of route maps from MapPoint is now as easy as entering an address in a worksheet cell. For example, I have made Excel UDFs that draw geometric shapes around MapPoint locations. Your current example opens a new Mappoint session each time, I would do it like I did in my Word sample. I have been messing with Mappoint thru vb functions but this works very will and is simplier than what i had been doing. Ive to let user draw radius circles on the map and then work out which clients exist within that circle. At present I draw circle successfully but it is drawn a bit back of my pointer and secondly it is not zoom-adjusted. May I be guided by anyone in this direction, Id be highly obliged. I wanted to find a way to speed up the UDF and in watching the Trace I noticed that the program spent mnost of its time creating the object. So I experimented and found this solution of reusing the object that had already been created. So far it seems to work fine, but I have to wonder if there might be something that I am missing that will eventually cause a problem. However, we have to clear the route so the waypoints dont keep getting added to the route. Set objApp GetObject(, MapPoint.Application) If Err.Number 0 Then Set objApp CreateObject(MapPoint.Application) End If On Error GoTo LEH. Otherwise the waypoints will be added to the activeroute, making the route longer and longer. ActiveRoute.Clear objmap.Saved True.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |