I have a function which checks if a file exists, if the file exists then it checks for a specific value in a specific cell, if thats true then it pulls the value from a given cell.
Problem is, a dialouge box keeps appearing when I run this code. I have inserted
Application.DisplayAlerts = False
into my FileExists function but I still get the dialogue box, any idea what Im doing wrong?
my function:
Function FileExists(FilePath As String) As Boolean
Application.DisplayAlerts = False
'Step 1: Declare your variables.
Dim FileName As String
'Step 2: Use the Dir function to get the file name
FileName = Dir(FilePath)
'Step 3: If file exists, return True else False
If FileName <> "" Then FileExists = True _
Else: FileExists = False
End Function
Sub FileExits()
End Sub
What Im inserting to the formula box:
=IF(FileExists("path\filename.xls"),IF('path\[filename.xls]Sheet'!D$13="16m8", 'path\[filename.xls]Sheet'!D40, ""),"false")
continued from here: https://stackoverflow.com/questions/39452159/excel-pull-data-from-one-excel-file-to-another-if-the-file-exists