Microsoft KB Archive/237585

= FP2000: How to Programmatically Save All Open Pages That Have Changed =

Article ID: 237585

Article Last Modified on 6/18/2005

-

APPLIES TO


 * Microsoft FrontPage 2000 Standard Edition

-



This article was previously published under Q237585



SUMMARY
This article describes how to write a macro in FrontPage 2000 that saves all open pages that have been changed.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. For more information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:

212536 OFF2000: How to Run Sample Code from Knowledge Base Articles



MORE INFORMATION
The Save All command does not exist in FrontPage 2000. However, you can easily implement it by using Visual Basic for Applications. The following code checks to see if any changes have been made to each open file since the last save. If changes have been made, it saves the file. This code requires that a web is open. Sub SaveAll ' First check to make sure that a page is open. If (ActiveWebWindow.PageWindows.Count > 0) Then ' If a page is open, set up variables. Dim myCurrentPage, myPageWindow As PageWindow

' Set myCurrentPage to the currently active page so we can go           ' back to this page when the macro is finished running. Set myCurrentPage = ActivePageWindow

' Now loop through each page in the web. For Each myPageWindow In ActiveWebWindow.PageWindows

' Activate the page so we can save it. myPageWindow.Activate ' Check to see if changes have been made to this page. If myPageWindow.IsDirty Then

' Execute the Save command on the File menu CommandBars("File").Controls("&Save").Execute

End If

Next

'Once the macro has finished, reactivate the original page. myCurrentPage.Activate

End If

End Sub Note About the Code

The Save method of the PageWindow object could have been used to save the pages. However, the Save method will not save a page if the page has never been saved since its creation (for example, new_page_1.htm). In that case, the SaveAs method must be used to save the unsaved page. Because the SaveAs method does not allow you to display a SaveAs dialog box to save the new page under a new name, this example chose to use the Execute method to save the pages.

Keywords: kbdtacode kbhowto KB237585

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.