One little piece of code that i have always found handy, is the ability to check and see if a file exists. I dont know where i got this code - it was a long time ago, but i thought what can i lose!??! I have heard you can check and see if a file exists with an API... well this dosent involve an API, and its only a couple lines!
dim fLen as integer, filepath as string
filepath = "C:\myfile.txt"
on error resume next
fLen = len(dir$(filepath))
if err or fLen = 0 then
'file dosent exist
else
'file exists
end if
Comments