Confirm disk is present

LwarenceD

New Member
Joined
Nov 24, 2005
Messages
29
OK, I wasn't expecting to ask another question this year as I am starting my Holiday leave tomorrow.. But this one stumped me and Its a simple one...

What am I missing here?

Code:
Function CheckDisk() As Boolean
CheckDisk = False
On Error GoTo NoDisk
x = Dir("H:\uaget.txt")
CheckDisk = True
MsgBox "Its there.", , _
               "Found it":
       'run the rest of the code here
Exit Function
NoDisk:
MsgBox "Please connect USB Jump Drive and run me again.", , _
               "Try Again":
End Function
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
See if maybe this helps:


Sub Test1()
Dim MyDrive$, MyDriveDir$
MyDrive = "H"
On Error Resume Next
MyDriveDir = Dir(MyDrive & ":\", 5)
If MyDriveDir = "" Or IsError(MyDriveDir) Then
MsgBox "No disk is in Drive " & MyDrive
Else
MsgBox "Drive " & MyDrive & " has a disk and is ready!"
End If
Err.Clear
End Sub
 
Upvote 0
Thanks Tom

Thats got to be the fastest reply on record.

And it works!

Now to alter my code a bit and cross my fingers that i wont be back until after the new year.


Happy Holidays everyone.
 
Upvote 0
SIGH.. Christmas will never come at this point..

This is not part of my project but looks like fun to play with..


I've spent the last 2 hours busting this code and messing up my workbook, thankfully this is for giggles.

How would I display all 5 inputs at teh same time on the same form, and allow a single click to send the results to 5 cells on a Sheet?



Code:
Sub Input_From_Users()
    Dim wbBook As Workbook
    Dim wsSheet As Worksheet
    Dim rnData As Range
    Dim vaArray As Variant, vaData As Variant
    Dim i As Long
     
    Const stPrompt As String = "Please enter values for calculation:"
    Const stTitle As String = "Indata for calculation of volume"
     
    Set wbBook = ThisWorkbook
    Set wsSheet = wbBook.Worksheets(1)
     
    With wsSheet
        Set rnData = .Range("A2:A6")
    End With
     
     'Default values
    vaArray = VBA.Array(1, 2, 3, 4, 5)
     
     'The inputbox is showed 5 times.
    vaData = Application.InputBox(Prompt:=stPrompt, _
    Title:=stTitle, _
    Default:=vaArray, _
    Type:=64)
     
     'In case the user cancel the operation.
    For i = 1 To 5
        If vaData(i) = Empty Then Exit Sub
    Next
     
     'Add the retrieved data to the range.
    With Application
        .ScreenUpdating = False
        rnData.Value = .Transpose(vaData)
        .ScreenUpdating = True
    End With
     
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,816
Members
449,049
Latest member
cybersurfer5000

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top