ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Doesn't work all the time (https://www.excelbanter.com/excel-programming/351839-doesnt-work-all-time.html)

Alex St-Pierre

Doesn't work all the time
 
Hi,
I have tried this and boolExist takes the value of true (doesn't work all
the time)
I have also try the cbool and doesn't work on excel 2002. I tried Cbool with
excel 2003 and it work's well.. It's very strange..

dim fso
set fso = createobject("scripting.flesystemobject")
boolExist = fso.fileexists("V:") (takes value true ??)
set fso = nothing
--
Alex St-Pierre

Kris

Doesn't work all the time
 
Alex St-Pierre wrote:
Hi,
I have tried this and boolExist takes the value of true (doesn't work all
the time)
I have also try the cbool and doesn't work on excel 2002. I tried Cbool with
excel 2003 and it work's well.. It's very strange..

dim fso
set fso = createobject("scripting.flesystemobject")
boolExist = fso.fileexists("V:") (takes value true ??)
set fso = nothing




You lost "i" in set fso = createobject("scripting.flesystemobject")

Ed

Doesn't work all the time
 
When you say "It doesn't work", what are you seeing? An error message?
Or just a False value?
Why don't you have
Dim boolExist As Boolean ? What is Cbool?
Is your network connection to your V: drive constant, or does it reconnect
every time it's called?
Are Excel 2002 and Excel 2003 on the same machines? Do both instances
have references to the Microsoft Scripting Runtime library?

Ed

"Alex St-Pierre" wrote in message
...
Hi,
I have tried this and boolExist takes the value of true (doesn't work all
the time)
I have also try the cbool and doesn't work on excel 2002. I tried Cbool

with
excel 2003 and it work's well.. It's very strange..

dim fso
set fso = createobject("scripting.flesystemobject")
boolExist = fso.fileexists("V:") (takes value true ??)
set fso = nothing
--
Alex St-Pierre




Dave Peterson

Doesn't work all the time
 
If you're looking for a drive, don't you want driveexists?

Dim BoolExist As Boolean
Dim FSO As Object
Set FSO = CreateObject("scripting.filesystemobject")
BoolExist = FSO.DriveExists(drivespec:="v")
MsgBox BoolExist



Alex St-Pierre wrote:

Hi,
I have tried this and boolExist takes the value of true (doesn't work all
the time)
I have also try the cbool and doesn't work on excel 2002. I tried Cbool with
excel 2003 and it work's well.. It's very strange..

dim fso
set fso = createobject("scripting.flesystemobject")
boolExist = fso.fileexists("V:") (takes value true ??)
set fso = nothing
--
Alex St-Pierre


--

Dave Peterson

Alex St-Pierre

Doesn't work all the time
 
Thank Dave..
What I did wrong is the following:

Dim FSO As Object
Set FSO = CreateObject("scripting.filesystemobject")
if FSO.DriveExists(drivespec:="v") = true then ...
MsgBox BoolExist
endif
So, I though FSO.Drive was true because the condition is satisfied.
By declaring a Boolean, I see that the result is false !!
--
Alex St-Pierre


"Dave Peterson" wrote:

If you're looking for a drive, don't you want driveexists?

Dim BoolExist As Boolean
Dim FSO As Object
Set FSO = CreateObject("scripting.filesystemobject")
BoolExist = FSO.DriveExists(drivespec:="v")
MsgBox BoolExist



Alex St-Pierre wrote:

Hi,
I have tried this and boolExist takes the value of true (doesn't work all
the time)
I have also try the cbool and doesn't work on excel 2002. I tried Cbool with
excel 2003 and it work's well.. It's very strange..

dim fso
set fso = createobject("scripting.flesystemobject")
boolExist = fso.fileexists("V:") (takes value true ??)
set fso = nothing
--
Alex St-Pierre


--

Dave Peterson



All times are GMT +1. The time now is 06:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com