|
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 strSaveAsUnique(strDocName As String, ByVal strSet As String, intLen As Integer, strPath As String, strName As String, strExtent As String) As String
' Procedure : CloseFiles
' Description: Close each file in a supplied list of files..
' Copyright: Chris Greaves Inc.
' Inputs: A string of filenames separated by and terminated by a delimiter.
' Returns: None.
' Assumes: None.
' Side Effects: None.
' Tested: By the calls shown below.
' Regardless of length, we make ONE attempt with the given file name
If boolFileExists(strPath & strName & strExtent) Then ' that file exists
' If the set is not yet empty,
' Augment the root name with each character of the set
' And essay with the augmented root and the deprived set
' If
If Len(strName) >= intLen Then
strSet = ""
Else
End If
If strSet <> "" Then
Dim i As Integer
For i = 1 To Len(strSet)
Dim strNew As String
strNew = strSaveAsUnique(strDocName, Left(strSet, i - 1) & Right(strSet, Len(strSet) - i), intLen, strPath, strName & Mid(strSet, i, 1), strExtent)
If strNew <> "" Then
strSaveAsUnique = strNew
Exit For
Else
End If
Next i
Else
End If
Else
strSaveAsUnique = strName
End If
'Sub TESTstrSaveAsUnique()
' Dim strNew As String
' strNew = strSaveAsUnique(ActiveDocument.Name, "abcdef", 3, strTemplatePath(), "erase4", ".txt")
' While strNew <> ""
' Open strTemplatePath() & strNew & ".txt" For Output As 1
' Print #1, "eraseU"
' Close 1
' strNew = strSaveAsUnique(ActiveDocument.Name, "abcdef", 3, strTemplatePath(), "erase4", ".txt")
' Wend
'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 |