View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Doug Glancy[_7_] Doug Glancy[_7_] is offline
external usenet poster
 
Posts: 55
Default Is filepath valid?

NickHK,

I didn't know that. How would you do it?

Doug

"NickHK" wrote in message
...
Personally, I would go with a non-Dir solution.
Using Dir sets the CurDir to that location. Whilst not a major problem, it
may impact your code in unexpected ways; calling GetOpenFilename will then
point to that last location, which is probably meaningless to the user.

NickHK

"Rookie_User" wrote in message
...
This worked GREAT - thank you.

"Mike" wrote:

You need a function. Open VB editor (ALT + F11) insert a new module and

paste
this code in:

Public Function Filethere(strFullPath As String) As Boolean
If Not Dir(strFullPath, vbDirectory) = vbNullString Then Filethere
=

True
End Function

in b1 next to your filepath in a1 type =filethere(a1)
drag down as required.
It will return true if the path is valid or false.

Will that do?

Mike

"Rookie_User" wrote:

I have a column that contains a file path with the file at the end -

all
contained in the cell. There are about 150 rows. I would like to
put
something in column be that says - yes the path and file are truly

there or
No it is invalid. I have searched multiple places and have not found
anything pointing to how to do this?