Share via


SaveAs method

Saves the specified map or template. Not available for embedded maps or the MapPoint Control.

Applies to

Objects: Map

Syntax

object.SaveAs([FileName], [SaveFormat], [AddToRecentFiles])

Parameters

Part

Description

object

Required. An expression that returns a Map object.

FileName

Optional String. Name of the file to save. You can specify the full path. If not specified, the default file name is used.

SaveFormat

Optional GeoSaveFormat. Format of the file to save. Default is geoFormatMap.

GeoSaveFormatValueDescription
geoFormatHTMLDirections3Saves driving directions as a Web page (*.htm)
geoFormatHTMLMap2Saves the map as a Web page (*.htm)
geoFormatHTMLMapAndDirections4Saves the map as a Web page with driving directions included (*.htm)
geoFormatMap0Saves the map as a map file (*.ptm)
geoFormatTemplate1Saves the map as a map template (*.ptt)

AddToRecentFiles

Optional Boolean. Adds the file to the Most Recently Used (MRU) list on the File menu. Default is True.

Remarks

Example

[Microsoft Visual Basic 6.0]

Sub SaveTemplate()

Dim objApp As New MapPoint.Application
Dim objMap As MapPoint.Map
Dim objRoute As MapPoint.Route
Dim objLoc As MapPoint.Location

'Set up the application
Set objMap = objApp.ActiveMap
Set objRoute = objMap.ActiveRoute
objApp.Visible = True
objApp.UserControl = True

'Create a route
objRoute.Waypoints.Add objMap.FindResults("Seattle, WA").Item(1)
objRoute.Waypoints.Add objMap.FindResults("Redmond, WA").Item(1)
objRoute.Calculate

'Save the map as a template
objMap.SaveAs "Saved Template", geoFormatTemplate, True

End Sub

[C#]

void SaveTemplate()
{
MapPoint.ApplicationClass objApp = new MapPoint.ApplicationClass();
MapPoint.Map objMap = null;
MapPoint.Location objLocStart = null;
MapPoint.Location objLocEnd = null;
MapPoint.Route objRoute = null;
object key = 1;

//Set up the application
objMap = objApp.ActiveMap;
objRoute = objMap.ActiveRoute;
objApp.Visible = true;
objApp.UserControl = true;

//Get start and end locations for route
objLocStart = (MapPoint.Location) objMap.FindResults("Seattle, WA").get_Item(ref key);
objLocEnd = (MapPoint.Location) objMap.FindResults("Redmond, WA").get_Item(ref key);

//Create and Calculate a route
objRoute.Waypoints.Add(objLocStart,"Start");
objRoute.Waypoints.Add(objLocEnd,"End");
objRoute.Calculate();

//Save the map as a template
objMap.SaveAs("Saved Template", MapPoint.GeoSaveFormat.geoFormatTemplate, true);

}

Note   This sample code is specifically for use in MapPoint North America; it is for illustration purposes only.