How do you "execute" a VBA "function". I'm trying to use the following code (found on the net) to check whether a file exists when a workbook is activated. If the file doesn't exist I want to save a copy of the workbook as a given name "Master Template".
Function FileExist(sTestFile As String) As Boolean
sTestFile = "C:\Business Cases\Master Template.xls"
Dim lSize As Long
On Error Resume Next
lSize = -1
lSize = FileLen(sTestFile)
If lSize < -1 Then
ActiveWorkbook.SaveAs Filename:="C:\ROI Business Cases\Master Template.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False
End If
End Function
Bookmarks