FP2000: How to Programmatically Save All Open Pages That Have Changed
ID: Q237585
|
The information in this article applies to:
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, including, but not limited to, the implied warranties of
merchantability and/or fitness for a particular purpose. This article assumes that you
are familiar with the programming language being demonstrated and the tools used to
create and debug procedures. Microsoft support professionals 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 needs. If you have limited
programming experience, you may want to contact a Microsoft Certified Solution Provider
or the Microsoft fee-based consulting line at (800) 936-5200. For more information about
Microsoft Certified Solution Providers, please see the following page on the World Wide Web:
http://www.microsoft.com/mcsp/
For more information about the support options available from Microsoft, please see the
following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/overview/overview.asp
For more information about using the sample code in this article, please
see the following article in the Microsoft Knowledge Base:
Q212536
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.
Additional query words:
Keywords : kbdta kbdtacode
Version : WINDOWS:
Platform : WINDOWS
Issue type : kbhowto