Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default code to check a: drive has a disk in


hi

How do i ensure that the user has put a disk in the drive. I have an
msgbox which pops up telling them to put a disk in before contiuning
however if their is no disk in it throughs out a debug.


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=380033

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default code to check a: drive has a disk in


This worked for me.


Sub test()

On Error GoTo MY
MyNAme = Dir("A:\")
Exit Sub

MY:
MsgBox "Please insert disk in A:"

End Sub



Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=380033

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default code to check a: drive has a disk in


that worked but how do i loop that until there is a disk in there

--
funkymonkU
-----------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...fo&userid=1813
View this thread: http://www.excelforum.com/showthread.php?threadid=38003

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default code to check a: drive has a disk in


Again, this worked for me:


Private Sub CommandButton1_Click()

ny:
a = test
If a = 1 Then
MsgBox "Insert disk"
GoTo ny
End If

End Sub

Function test()
On Error GoTo my
test = Dir("A:\")
Exit Function

my:
test = 1

End Function



Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=380033

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default code to check a: drive has a disk in


i am having problems trying to implement within my code because of th
function could you tell me abit more about functions

--
funkymonkU
-----------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...fo&userid=1813
View this thread: http://www.excelforum.com/showthread.php?threadid=38003



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default code to check a: drive has a disk in


In your code, when you want to check the A: part, simply use:

ny:
a = test
If a = 1 Then
MsgBox "Insert disk"
GoTo ny
End If


When your code is over, put the function in the earlier post.



Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=380033

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default code to check a: drive has a disk in


i did that however when I put the disk in is debugs with type missmatc
and highlights if a=1 then part

when i move of a it shows it is ""

if i have a file on the disk it shows the files name any ideas

--
funkymonkU
-----------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...fo&userid=1813
View this thread: http://www.excelforum.com/showthread.php?threadid=38003

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default code to check a: drive has a disk in

Here is another idea that uses the "IsReady" property to tell if the drive
has a disk. I included an example of using "DriveExists" as some computers
(ie notebooks) do not have an A: drive.

Sub YourMainCode()
'Your code....then
Do While Not Check
MsgBox "Insert Disk in A"
Loop
' Has disk, so continue with my code...
' ....etc
End Sub

Function Check() As Boolean
Const A_Drive As String = "A:\"

With CreateObject("Scripting.FileSystemObject")
If .DriveExists(A_Drive) Then
Check = .GetDrive(A_Drive).IsReady
Else
' Your code here if A: Drive does not exists...
' Something like...
MsgBox "No A:\ drive detected"
End If
End With
End Function

HTH :)

--
Dana DeLouis
Win XP & Office 2003


"funkymonkUK"
wrote in message
...

i did that however when I put the disk in is debugs with type missmatch
and highlights if a=1 then part

when i move of a it shows it is ""

if i have a file on the disk it shows the files name any ideas?


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile:
http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=380033



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default code to check a: drive has a disk in


thanks for thank however i know the user has an A: drive I just need to
know how to check if the disk is in anf if not bring out an error
message and do so until a disk has been inserted.


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=380033

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting Amount Free Disk Space On A Drive mrclinker Excel Discussion (Misc queries) 2 May 12th 06 01:16 PM
excel 2002 wont accept my code on back of disk racer New Users to Excel 1 December 6th 05 11:56 AM
Check Drive Space Charles Excel Programming 3 October 6th 04 07:12 PM
Is there a floppy disk in Drive A? Hotbird Excel Programming 1 August 21st 03 11:00 PM
Find links with code; change from G drive to C drive Sandy[_3_] Excel Programming 4 July 26th 03 07:24 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"