Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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) |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Launching Excel causes floppy drive access | Excel Discussion (Misc queries) | |||
How repeat a task on all files on a floppy drive | Excel Discussion (Misc queries) | |||
floppy not accessible in a drive | Excel Discussion (Misc queries) | |||
floppy not accessible in a drive | Excel Discussion (Misc queries) | |||
Is there a floppy disk in Drive A? | Excel Programming |