View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
GS GS is offline
external usenet poster
 
Posts: 364
Default Disable the prompt when clicking on a protected cell?

Let me clarify: It returns FALSE if there's any error, whether the path or
filename.

Regards,
Garry

"GS" wrote:

Hi Frank,

Here's a function I use to determine if a file exists or not. It doesn't
detect a path error per se, but it requires the fullname of the file being
tested for. You could display a message that shows the user what the path and
file being tested is.

Regards,
Garry

'--------------
Function bFileExists(fileName As String) As Boolean
' Checks if a file exists in the specified folder
' Arguments: fileName The fullname of the file
' Returns: TRUE if the file exists

Const sSource As String = "bFileExists()"

On Error Resume Next
bFileExists = (Dir$(fileName) < "")

End Function

To use it:

If bFileExists(FullPathAndFilename) then...
-OR-
If Not bFileExists(FullPathAndFilename) then...
'----------------