C
Chris
Hello All
I have a function that detects if the same file name being used when saving
a file.
On duplicate file names, I would like to add a number onto the file name.
If a filename exists with a number added, i would like to increment this
number by one.
can you help.
Public Function File(ByVal strFullPathName As String) As Boolean
Dim intIdentifier As Integer
If Dir(strFullPathName, vbNormal) <> vbNullString Then
File = True
intIdentifier = 1
strFullPathName = strFullPathName2 & intIdentifier & ".doc"
'strFullPathName2 = strFullPathname without the .doc
End If
Set objDoc = objWord.Documents.Open(strdir & strTemplate)
'strdir = directory of template & strTemplate = name of word doc
objWord.Application.ActiveDocument.SaveAs (strFullPathName)
End Function
I have a function that detects if the same file name being used when saving
a file.
On duplicate file names, I would like to add a number onto the file name.
If a filename exists with a number added, i would like to increment this
number by one.
can you help.
Public Function File(ByVal strFullPathName As String) As Boolean
Dim intIdentifier As Integer
If Dir(strFullPathName, vbNormal) <> vbNullString Then
File = True
intIdentifier = 1
strFullPathName = strFullPathName2 & intIdentifier & ".doc"
'strFullPathName2 = strFullPathname without the .doc
End If
Set objDoc = objWord.Documents.Open(strdir & strTemplate)
'strdir = directory of template & strTemplate = name of word doc
objWord.Application.ActiveDocument.SaveAs (strFullPathName)
End Function