ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is the floppy in the A drive? (https://www.excelbanter.com/excel-programming/317859-floppy-drive.html)

Jim Simpson

Is the floppy in the A drive?
 
I would like to determine if the floppy in the "A" drive and if it is post a
msgbox saying so. I have not been able to do this and haven't seen any
messages on the subject.

Can someone please help me?.
Thanks

Jim



Tim Williams

Is the floppy in the A drive?
 
try this

Function FloppyInDrive()
Dim sTemp

On Error GoTo haveError
sTemp = Dir("A:\")
FloppyInDrive = True
Exit Function

haveError:
FloppyInDrive = False
End Function

Tim.

"jim simpson" wrote in message
news:54Kpd.2597$QR.2064@lakeread01...
I would like to determine if the floppy in the "A" drive and if it is
post a
msgbox saying so. I have not been able to do this and haven't seen
any
messages on the subject.

Can someone please help me?.
Thanks

Jim





Dave Peterson[_5_]

Is the floppy in the A drive?
 
Another option:

Option Explicit
Sub testme03()

'Dim FSO As Scripting.FileSystemObject
Dim FSO As Object

'Set FSO = New Scripting.FileSystemObject
Set FSO = CreateObject("scripting.filesystemobject")

With Application
If FSO.Drives("a").IsReady Then
MsgBox "ok"
Else
MsgBox "not ready"
End If
End With
End Sub


If you uncommment the top lines of each pair (and comment the bottom), you'll
have to set a reference (tools|references) to Microsoft Scripting Runtime.

When you have that reference set, you'll get the VBE's intellisense to help you
complete your code.



jim simpson wrote:

I would like to determine if the floppy in the "A" drive and if it is post a
msgbox saying so. I have not been able to do this and haven't seen any
messages on the subject.

Can someone please help me?.
Thanks

Jim


--

Dave Peterson

Jim Simpson

Is the floppy in the A drive?
 
Thanks to both Tim and Dave for responding.

Dave sometning doesn't work with the top lines of each pair commented out. I
get a complaint about "ScriptingFileSystemObject". It says "User defined
type not defined". I'm using Excel 2000 with Win98, could that be the
problem?

Jim


"Dave Peterson" wrote in message
...
Another option:

Option Explicit
Sub testme03()

'Dim FSO As Scripting.FileSystemObject
Dim FSO As Object

'Set FSO = New Scripting.FileSystemObject
Set FSO = CreateObject("scripting.filesystemobject")

With Application
If FSO.Drives("a").IsReady Then
MsgBox "ok"
Else
MsgBox "not ready"
End If
End With
End Sub


If you uncommment the top lines of each pair (and comment the bottom),

you'll
have to set a reference (tools|references) to Microsoft Scripting Runtime.

When you have that reference set, you'll get the VBE's intellisense to

help you
complete your code.



jim simpson wrote:

I would like to determine if the floppy in the "A" drive and if it is

post a
msgbox saying so. I have not been able to do this and haven't seen any
messages on the subject.

Can someone please help me?.
Thanks

Jim


--

Dave Peterson




Joe Fawcett

Is the floppy in the A drive?
 
"jim simpson" wrote in message
news:xX%pd.2784$QR.1669@lakeread01...
Thanks to both Tim and Dave for responding.

Dave sometning doesn't work with the top lines of each pair commented out.
I
get a complaint about "ScriptingFileSystemObject". It says "User defined
type not defined". I'm using Excel 2000 with Win98, could that be the
problem?

Jim


If you want to use early binding which is more efficient you need to go to
Tools | References in the VBA editor and check the box next to Microsoft
Scripoting Runtime, or use the browse button to find scrrun.dll in your
system directory. Then you use:

Dim FSO As Scripting.FileSystemObject
Set FSO = New Scripting.FileSystemObject

This also gives you intellisense support. If setting a refence is going to
be awkward then you can use late binding with:

Dim FSO As Object
Set FSO = CreateObject("scripting.filesystemobject")

--

Joe (MVP)



Peter T

Is the floppy in the A drive?
 
Jim,

Both Dave's methods worked for me in Win98 / XL2000

If you uncomment the first pair you need to comment the second pair AND set
a reference to Microsoft Scripting Runtime, the way Dave described.

Regards,
Peter


"jim simpson" wrote in message
news:xX%pd.2784$QR.1669@lakeread01...
Thanks to both Tim and Dave for responding.

Dave sometning doesn't work with the top lines of each pair commented out.

I
get a complaint about "ScriptingFileSystemObject". It says "User defined
type not defined". I'm using Excel 2000 with Win98, could that be the
problem?

Jim


"Dave Peterson" wrote in message
...
Another option:

Option Explicit
Sub testme03()

'Dim FSO As Scripting.FileSystemObject
Dim FSO As Object

'Set FSO = New Scripting.FileSystemObject
Set FSO = CreateObject("scripting.filesystemobject")

With Application
If FSO.Drives("a").IsReady Then
MsgBox "ok"
Else
MsgBox "not ready"
End If
End With
End Sub


If you uncommment the top lines of each pair (and comment the bottom),

you'll
have to set a reference (tools|references) to Microsoft Scripting

Runtime.

When you have that reference set, you'll get the VBE's intellisense to

help you
complete your code.



jim simpson wrote:

I would like to determine if the floppy in the "A" drive and if it is

post a
msgbox saying so. I have not been able to do this and haven't seen any
messages on the subject.

Can someone please help me?.
Thanks

Jim


--

Dave Peterson






Jim Simpson

Is the floppy in the A drive?
 
Thanks Guys, for all hte great help.

Clicking on the "Microsoft Scripoting Runtime" box did the trick. Now I have
2 solutions to my problem.

Jim

"Peter T" <peter_t@discussions wrote in message
...
Jim,

Both Dave's methods worked for me in Win98 / XL2000

If you uncomment the first pair you need to comment the second pair AND

set
a reference to Microsoft Scripting Runtime, the way Dave described.

Regards,
Peter


"jim simpson" wrote in message
news:xX%pd.2784$QR.1669@lakeread01...
Thanks to both Tim and Dave for responding.

Dave sometning doesn't work with the top lines of each pair commented

out.
I
get a complaint about "ScriptingFileSystemObject". It says "User defined
type not defined". I'm using Excel 2000 with Win98, could that be the
problem?

Jim


"Dave Peterson" wrote in message
...
Another option:

Option Explicit
Sub testme03()

'Dim FSO As Scripting.FileSystemObject
Dim FSO As Object

'Set FSO = New Scripting.FileSystemObject
Set FSO = CreateObject("scripting.filesystemobject")

With Application
If FSO.Drives("a").IsReady Then
MsgBox "ok"
Else
MsgBox "not ready"
End If
End With
End Sub


If you uncommment the top lines of each pair (and comment the bottom),

you'll
have to set a reference (tools|references) to Microsoft Scripting

Runtime.

When you have that reference set, you'll get the VBE's intellisense to

help you
complete your code.



jim simpson wrote:

I would like to determine if the floppy in the "A" drive and if it

is
post a
msgbox saying so. I have not been able to do this and haven't seen

any
messages on the subject.

Can someone please help me?.
Thanks

Jim

--

Dave Peterson









All times are GMT +1. The time now is 04:12 PM.

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