Search for active file name (modified), then....
When a file has been E-Mailed with my code, it is saved as
C:\Contracts EMailed\'Current file name' + _EM.
IF one tries to resave the original file, this code is to check
if it has been saved before.
If YES, then, exit, if NO, continue.
Sub CheckFileName()
' Check if the following exists:
' C:\Contracts EMailed\'filename'_EM.xls
' IF it exists, then Process is not allowed
' NotAllowed Message pops up, Click OK, and project Exits
' If it does NOT exist, then Continue
Dim FName As String
FName = ActiveWorkbook.Name
Dim NewName As String
NewName = FName + "_EM"
' The following line comes up with Compile Error - Syntax error
If "C:\Contracts EMailed\NewName.Exists = True Then
Call NotAllowed
Else: Exit Sub
End If
End Sub
|