Sorry, I was wrong. There are two functions that will not be in Word 97, Replace and InstrRev
This code from www.FreeVbCode.com can be used instead
You can add them alongside the macro.
Public Function InStrRev(ByVal sIn As String, ByVal _
sFind As String, Optional nStart As Long = 1, _
Optional bCompare As VbCompareMethod = vbBinaryCompare) _
As Long
Dim nPos As Long
sIn = Reverse(sIn)
sFind = Reverse(sFind)
nPos = InStr(nStart, sIn, sFind, bCompare)
If nPos = 0 Then
InStrRev = 0
Else
InStrRev = Len(sIn) - nPos - Len(sFind) + 2
End If
End Function
Public Function Join(Source() As String, _
Optional sDelim As String = " ") As String
Dim nC As Long
Dim sOut As String
For nC = LBound(Source) To UBound(Source) - 1
sOut = sOut & Source(nC) & sDelim
Next
Join = sOut & Source(nC)
End Function
Public Function Replace(ByVal sIn As String, ByVal sFind As _
String, ByVal sReplace As String, Optional nStart As _
Long = 1, Optional nCount As Long = -1, _
Optional bCompare As VbCompareMethod = vbBinaryCompare) As _
String
Dim nC As Long, nPos As Long
Dim nFindLen As Long, nReplaceLen As Long
nFindLen = Len(sFind)
nReplaceLen = Len(sReplace)
If (sFind <> "") And (sFind <> sReplace) Then
nPos = InStr(nStart, sIn, sFind, bCompare)
Do While nPos
nC = nC + 1
sIn = Left(sIn, nPos - 1) & sReplace & _
Mid(sIn, nPos + nFindLen)
If nCount <> -1 And nC >= nCount Then Exit Do
nPos = InStr(nPos + nReplaceLen, sIn, sFind, _
bCompare)
Loop
End If
Replace = sIn
End Function
Main Topics
Browse All Topics





by: GrahamSkanPosted on 2004-08-23 at 15:13:36ID: 11875814
Hi,
As far as I can see there are no version issues with the macro that you indicate.
File naming is an OS issue and has not changed since long names were introduced.
Since you have the environments that require validating, I suggest that you try them and, if you have a problem and can't work out a fix, that you request help at that point.
Regards, Graham