Link to home
Start Free TrialLog in
Avatar of ralphy
ralphy

asked on

fileexists

In vb4 I'm trying to have a button either setup a program(if it is not on the computer) or shell to the program if it is already there. I would like to use an If....Else but I can't figure out how to use the fileexists wording.
ASKER CERTIFIED SOLUTION
Avatar of Mirkwood
Mirkwood

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ralphy
ralphy

ASKER

I get a user defined type not defined msg, and x as vbfileattribute is highlighted.
Oh, you are using vb4. Try and see if getattr exists. If it does just replace vbFileAttribute with the return type of getattr
Avatar of ralphy

ASKER

I still get the user defined type not defined msg for getattr
Public Function fileExist(fileName As String) As Boolean
    Dim l As Long
   
    On Error Resume Next
   
    l = FileLen(fileName)
   
    fileExist = Not (Err.Number > 0)
   
    On Error GoTo 0
End Function
Avatar of ralphy

ASKER

Thanks alot mirkwood, Looks like it'll work fine.
   Ralphy