Visual Basic (VB6 and VBA)

Copyright 1999-2001 Christopher Greaves. All rights reserved.
Home Page and email to [email protected]
If in doubt, record a macro and inspect the entrails!

 

Visual Basic Library

This page was last updated on Saturday, November 24, 2001

Public Function blnDocumentIsChanged(doc As Document) As Boolean ' Procedure: blnFileIsChanged ' Description: Return TRUE if the stamp has changed (size, date, time) ' Copyright: Chris Greaves Inc. ' Inputs: DOCUMENT ' Returns: BOOLEAN ' Assumes: The document exists (use boolFileExists) ' Side Effects: The INI file contents may change ' Tested: By the calls listed below. ' This procedure calls "strDocumentStamp" to effect an entry in the INI file that looks like this: ' [Utils] ' D:\GREAVES\Products\Utils\Utils139.dot=|1657856|11/20/01 4:15:00 PM ' We can use this stamp in a variety of ways. ' For example, my application WbWrd generates a web site from a set of hyperlinked documents. ' In building a site from the source documents I can test which documents have changed since the last build ' and generate a DOS BATch file identifying those files whose HTML forms need to be uploaded to the site. ' Use the document full name as the key to the INI file. Dim strKey As String strKey = doc.FullName ' Get the previous value, if any, from the INI file. Dim strOldStamp As String strOldStamp = strGPA(strKey, "") ' No default value ' Get the current value from the document. Dim strNewStamp As String strNewStamp = strDocumentStamp(doc) ' Compare the previous and current values If strOldStamp = strNewStamp Then ' no change blnDocumentIsChanged = False Else blnDocumentIsChanged = True ' And save the new value back in the INI file. strOldStamp = strNewStamp Call strPPA(strKey, strOldStamp) End If 'Sub TESTblnDocumentIsChanged() 'MsgBox blnDocumentIsChanged(ActiveDocument) ' TRUE maybe on the first call 'MsgBox blnDocumentIsChanged(ActiveDocument) ' FALSE always on the second call 'End Sub End Function

We all knew nothing when we started …
Home Page and Contact Information
Send email to [email protected].
This page was last updated Monday, November 19, 2001

 

 

Hosted by www.Geocities.ws

1