verify a path exists
Nope just 71 in Oct. I used the Dir() function but I found that the back
slash and a file name are required to make it work right.
exmpl: teststr = Dir("C:\Windows\Media\*.mid") . This gives me specific
info to make the program run right.
Thanks again.
"Dave Peterson" wrote:
Man, I hope you're not 80.
The first 9 years would have been tough!
JLGWhiz wrote:
Thanks Dave, I knew it was not that hard, but my 71 year old brain don't
function too well sometimes.
"Dave Peterson" wrote:
I do this:
Dim TestStr as string
teststr = ""
on error resume next
teststr = dir("c:\windows\media\nul")
on error goto 0
if teststr = "" then
'doesn't exist
else
'it's there
end if
====
But this'll work, too:
If CreateObject("Scripting.FileSystemobject") _
.folderexists("C:\windows\media") = True Then
MsgBox "Yep"
Else
MsgBox "nope"
End If
JLGWhiz wrote:
This is probably so simple that I am overlooking it. I want to write code as
an If...Then method to verify that a certain path exists. Let's say
"C:\Windows|Media".
I tried the Exists( What ) method but could not find an object that VBA
liked. Make me feel stupid and show me the code. Thanks.
--
Dave Peterson
--
Dave Peterson
|