|
Visual Basic (VB 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! |
Please read the DISCLAIMER.
Here is an INDEX to all the procedures.
You will probably need one copy of my GLOBAL DECLARATIONS.
Public Function boolOpenFile(strFile As String, Optional strSignature) As Boolean
' Procedure : boolOpenFile
' Description: Determine if the file is open, if not, open it.
' Copyright: Chris Greaves Inc.
' Inputs: STRING full filename and path; optional signature.
' Returns: TRUE if file is now open.
' Assumes: Nothing
' Side Effects: None.
' Tested: By the calls shown below.
' Remarks: Applications otfen require a Rules table.
' If the table document is stamped with a signature (strPutStamp)
' We can test for the presence of,
' or ask the user to confirm insertion of such a signature.
' If the signature (string) parameter is present and we cannot locate it,
' We close the opened document and report 'failure to open"
boolOpenFile = False
Dim strDoc As String
strDoc = strGetFilename(strFile, intcFullName)
If boolFULLDocIsOpen(strFile) Then
boolOpenFile = True
If IsMissing(strSignature) Then ' no need to check the signature
Else
boolOpenFile = boolCheckSignature(ActiveDocument.Name, strSignature)
End If
Else
If boolFileExists(strFile) Then
Documents.Open FileName:=strFile
If boolTestLocked(ActiveDocument) Then
ActiveDocument.Close savechanges:=wdDoNotSaveChanges
Else
boolOpenFile = True
If IsMissing(strSignature) Then ' no need to check the signature
Else
boolOpenFile = boolCheckSignature(ActiveDocument.Name, strSignature)
End If
End If
Else
End If
End If
' Once opened, is it a template? Is it protected?
'Sub TESTboolOpenFile()
' MsgBox boolOpenFile("d:\greaves\products\indxr\indexRul.DOC") ' no signature required
' MsgBox boolOpenFile("d:\greaves\products\indxr\indexRul.DOC", "1234") ' signature required
' MsgBox boolOpenFile("d:\greaves\products\indxr\indexRul.DOC", "1234") ' SAME signature required
' MsgBox boolOpenFile("d:\greaves\products\indxr\indexRul.DOC", "12345") ' DIFFERENT signature required
'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 Thursday, November 15, 2001 |