View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
2007-User 2007-User is offline
external usenet poster
 
Posts: 35
Default check to see a file is existed

Thanks,!

"RB Smissaert" wrote in message
...
To check if a file exists use a function like this:

Function bFileExists(ByVal sFile As String) As Boolean

Dim lAttr As Long

On Error Resume Next
lAttr = GetAttr(sFile)
bFileExists = (Err.Number = 0) And ((lAttr And vbDirectory) = 0)
On Error GoTo 0

End Function


To open a file look at Shell in the VBA help.


RBS


"2007-User" wrote in message
...
Hi Guys,

How Can I :
1- check to see a file (non excel file) is existed?
2- like I do double click on a file (on windows area) to open it with its
application, how can I do the same thing with VBA?

Thanks in advance