|
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 blnBookmarkExists(strFile As String, strBkMark As String) As Boolean ' Procedure : blnBookmarkExists ' Description: Test for existence of a bookmark ' Copyright: Chris Greaves Inc. ' Inputs: A document name, a bookmark name.. ' Returns: TRUE if the supplied bookmark is in the existing document. ' Assumes: None. ' Side Effects: None. ' Tested: By the calls shown below. blnBookmarkExists = False If boolFileExists(strFile) Then Dim strDoc As String strDoc = strGetFilename(strFile, intcFullName) If boolOpenFile(strFile) Then Dim lngBookmarks As Long lngBookmarks = Documents(strFile).Bookmarks.Count Dim lngInd As Long For lngInd = 1 To lngBookmarks If strBkMark = Documents(strFile).Bookmarks(lngInd) Then blnBookmarkExists = True Exit For End If Next lngInd Else End If Else End If 'Sub TESTblnBookmarkExists() ' MsgBox blnBookmarkExists(strTemplatePath & "utils140.dot", "alpha") ' TRUE - the file exists and the bookmark does exist in the file. ' MsgBox blnBookmarkExists(strTemplatePath & "utils140.dot", "omega") ' FALSE - the file exists but the bookmark does not exist in the file ' MsgBox blnBookmarkExists(strTemplatePath & "zutils140.dot", "alpha") ' FALSE - this file does not exist '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 |