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 Tuesday, November 27, 2001

Public Function blnDocIsOpen(strFileName As String) ' Procedure : blnDocIsOpen ' Description: Test if a specific document, identified as a fail name, is openm on the desktop. ' Copyright: Chris Greaves Inc. ' Inputs: STRING name of file to be tested. ' Returns: TRUE if the document name can be found in the set of open documents. ' Assumes: Nothing ' Side Effects: None. ' Tested: By the calls shown below. blnDocIsOpen = False If strFileName <> "" Then Dim doc As Document For Each doc In Documents If UCase(doc.FullName) = UCase(strFileName) Or UCase(doc.Name) = UCase(strFileName) Then blnDocIsOpen = True Exit For Else End If Next doc Else End If 'Sub TESTblnDocIsOpen() ' MsgBox blnDocIsOpen(MacroContainer.Name) ' TRUE ' MsgBox blnDocIsOpen("utils141.dot") ' TRUE ' MsgBox blnDocIsOpen("d:\greaves\products\utils\utils141.dot") ' TRUE ' MsgBox blnDocIsOpen("D:\GREAVES\PRODUCTS\UTILS\UTILS141.DOT") ' TRUE ' MsgBox blnDocIsOpen("CD:\GREAVES\PRODUCTS\UTILS\UTILS141.DOT") ' FALSE '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