BUG: Repetitively Saving Maps as HTML Pages by Automation Causes Loss of Pushpins (317977)
The information in this article applies to:
This article was previously published under Q317977 SYMPTOMS
When you save multiple maps as Web pages (.htm files) by either automating the call to the SaveAs method, or by using the SavedWebPages.Add method, any pushpins are lost after the program saves a large number of pages. The number of times that the program saves .htm files before you receive an error message varies according to the method of saving, and whether your program automates MapPoint directly, or from in the MapPoint Control.
This occurs when you save maps from either MapPoint or from the MapPoint Control. Based on the complexity of the program, you may receive the following error message:
Method Add of Object SavedWebPages failed.
RESOLUTION
To work around this behavior, use one of the following methods depending on your method of saving:
Method 1
If your program uses the SavedWebPages.Add method in the MapPoint Control, the error will occurs after you save 502 maps. To work around this problem, remove the current map from the control after you save 502 maps. This causes MapPoint to quit. Call the Sleep application programming interface (API), with a sleep value of 5000 to 10000 milliseconds to make sure that MapPoint is no longer in the Windows processes list, and then reload a map in the control and continue for 502 more pages.
Method 2
When you use SavedWebPages.Add when you automate MapPoint outside the control, the number of times that the program saves .htm files before the error occurs varies. When the automation program uses this combination, you must experiment to determine the number of pages that are saved before the error occurs. As soon as the automation program reaches this number, save the current map, and then quit MapPoint.
After MapPoint quits, the automation program can create a new instance of MapPoint, load the next map to process, and continue to add to the SavedWebPage collection. The program can repeat this process each time that the count of saved Web pages reaches the number that you determined through experimentation.
Method 3
When the automation program uses call to the SaveAs method, the pushpins disappear from the saved .htm file and from the active map in MapPoint after the program saves 137 times. After the pushpins disappear, MapPoint may become unstable and may stop responding.
To work around this behavior, quit MapPoint when the SaveAs method successfully saves 131 maps, and then create a new instance of MapPoint and continue to save maps as web pages.
Before you remove the current map from the control or quit MapPoint, the automation program needs to save any applicable values that it needs to reload to run with the new instance of MapPoint. Often, you can save these values by assigning them to global variables.
STATUSMicrosoft has confirmed that this is a problem in Microsoft MapPoint 2002. REFERENCESFor additional information, click the article numbers below
to view the articles in the Microsoft Knowledge Base:
302885 HOWTO: Use the MapPoint 2002 Control and Automation With Visual Basic to Save a Map as HTML
302897 HOW TO: Automate the MapPoint 2002 Control and Save the Map as HTML in Visual Basic .NET
Modification Type: | Major | Last Reviewed: | 5/9/2002 |
---|
Keywords: | kbAutomation kbbug kbDSupport KB317977 |
---|
|