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 5 of 5

How to disable the save dialog box

This is a discussion on How to disable the save dialog box within the MapPoint Desktop Discussion forums, part of the Map Forums category; I am using vba from excel 2002(XP) and adding some mappoint functionality. I got it to show the map using ...

  1. #1
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    How to disable the save dialog box

    I am using vba from excel 2002(XP) and adding some mappoint functionality. I got it to show the map using the following code .

    objApp.ActiveMap.DataSets.ShowDataMappingWizard _ DataSetToUse:=objDataSet, StartPage:=geoDataFieldsPage

    objApp.ActiveMap.CopyMap
    Worksheets("Demand_Maps").Select
    Worksheets("Demand_Maps").Range("e8").Select 'Select e8
    Worksheets("Demand_Maps").Paste

    This puts the pie chart in the Demand_Maps sheet. Now I have two questions :
    1. As soon as it copies the map to the sheet .. it shows a Mappoint dialog box with the message 'Save Changes to Map?' . Is there anyway to disable that dialog box so that it does not appear ?

    2. It only copies the map to the spreadsheet but not the legends for different colors in the pie chart. But when you use the actual mappoint software it shows the maps with the pie chart and to the left of it is the legends diagram.

    I would really appreciate your help.
    Thanks,
    Reza

  2. #2
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Hi Raza,

    For disabling the save dialog box please use

    axMPCtrl.ActiveMap.Saved = true;

    U can use it prior to loading of new map.

  3. #3
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    Save Dialog box troubles

    I'm having a little trouble with turning off the "Save changes to Map?" dialog box as well. I've tried the suggested methods I've seen

    axMPCtrl.ActiveMap.Saved = true
    objApp.ActiveMap.Saved = true

    but haven't had any luck... I'm just using a loop to read in two locations from excel and calculate distance. I get the save dialog box when I execute the line .... Set objLoc2 = objMap.Find(myFind2)
    and upon exiting the program.

    Code:
    Sub Measure_it()
        Dim objApp As Object 'MapPoint.Application
        Dim objMap As Object 'MapPoint.Map
        Dim objRoute As Object 'as MapPoint.Route
        Dim objLoc As Object 'MapPoint.Location
        Dim objLoc2 As Object 'MapPoint.Location
        Dim myAdd, myAdd2, myCity, myCity2, myState, myState2, myFind, myFind2 As String
        Dim myZip, myZip2, myRow As Integer
        number_rows = Cells(1, 11).Value + 1
        
    On Error Resume Next
    For myRow = 2 To number_rows
        myAdd = Cells(myRow, 2)     'Use the first column as the address info
        myCity = Cells(myRow, 3)        'Use the second column as the city info
        myState = Cells(myRow, 4)       'Use the third column as the state info
        myZip = Cells(myRow, 5)     'Use the fourth column as the zip info
        
        myAdd2 = Cells(myRow, 6)     'Use the first column as the address info
        myCity2 = Cells(myRow, 7)        'Use the second column as the city info
        myState2 = Cells(myRow, 8)       'Use the third column as the state info
        myZip2 = Cells(myRow, 9)     'Use the fourth column as the zip info
        
        'The first column on the spreadsheet is a blank used for the confirmation info below
        Cells(myRow, 1).Value = ""
        Cells(myRow, 10).Value = ""
        Cells(myRow, 1).Interior.ColorIndex = xlColorIndexNone  'Set background
        
        If Len&#40;myAdd&#41; < 2 Then Exit Sub 'If the address is less than 2 characters, exit
        If Len&#40;myAdd2&#41; < 2 Then Exit Sub 'If the address is less than 2 characters, exit
        Set objApp = CreateObject&#40;"Mappoint.Application"&#41;
        Set objMap = objApp.newMap      'Create the new map
        Set objRoute = objMap.activeRoute
        myFind = myAdd & "," & myCity & "," & myState   'Create the address string
        myFind2 = myAdd2 & "," & myCity2 & "," & myState2 'Create 2nd address string
        Set objLoc = objMap.Find&#40;myFind&#41;    'Find the new address
        Set objLoc2 = objMap.Find&#40;myFind2&#41;    'Find the new address
        objRoute.Waypoints.Add objLoc
        objRoute.Waypoints.Add objLoc2
        objRoute.Calculate
        Cells&#40;myRow, 10&#41; = objRoute.Distance
    
        If Not objLoc Is Nothing Then     'If found, start processing
            Cells&#40;myRow, 1&#41;.Value = "Found!"    'Change 1st column to found
            Cells&#40;myRow, 1&#41;.Interior.ColorIndex = 4 'Change color to Green
            Cells&#40;myRow, 2&#41;.Select      'Reselect our address field
        Else
            Cells&#40;myRow, 1&#41;.Value = "Not Found!"    'Didn't find the address
            Cells&#40;myRow, 1&#41;.Interior.ColorIndex = 3 'Set color to red
        End If
        
        Set objLoc = Nothing
        Set objMap = Nothing
        Set objApp = Nothing
        Next
    On Error GoTo 0
    End Sub
    Any thoughts would be greatly appreciated. Thanks.

    -Ryan

  4. #4
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    Figured it out

    Hey guys,

    Nevermind... I figured it out...

    I needed ... objRoute.Clear
    so that I could use the route repeatedly and just initiate the map once at the start of my program.

  5. #5
    tea_boy is offline Junior Member White Belt
    Join Date
    Nov 2006
    Posts
    9

    Re: How to disable the save dialog box

    In order stop the map from asking you to save when you exit your application the method of setting the saved property to true as described above:

    this.oApp.ActiveMap.Saved = true;

    will work. i found the best time to call this line of code was on a formClosing event,

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. avoid MP std save dialog??
    By Nostradamus in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 09-08-2004, 10:13 AM
  2. Disable MapPoint Help in MFC VC++ dialog based application
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 08-04-2004, 10:09 AM
  3. Disable save
    By Dazzer in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-28-2003, 05:30 AM
  4. Preventing 'Save As' Dialog (using the OCX!)
    By daxydoggie in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-15-2003, 03:07 PM
  5. How to prevent Save map dialog appearing?
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-21-2002, 08:05 PM

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