check to see a file is existed
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 |
check to see a file is existed
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 |
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 |
All times are GMT +1. The time now is 01:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com