Firemansam
Registered User.
- Local time
- Today, 21:12
- Joined
- Mar 28, 2007
- Messages
- 16
G'day All,
I was wondering whether some could help me get this to work. Iam basically trying to get a message only when the "M" drive is connected. It keeps coming up telling me "Block If without End If" that way I see it I have and End If statement after every If statement.
Any help would be appreciated.
Sub Test()
Dim fs, d, dc, s, n
Set fs = CreateObject("Scripting.FileSystemObject")
Set dc = fs.Drives
For Each d In dc
'If d.DriveType = 3 Then
' n = d.volumeName
'End If
If d.driveletter = "A" Or "B" Or "C" Or "D" Or "E" Or "F" Or "G" Or "H" Then
MsgBox "This is not the right drive", vbCritical, "Failed"
Else
If d.driveletter = "M" Then
MsgBox "The M Drive was found", vbExclamation, "Success"
End If
'Next
End Sub
I was wondering whether some could help me get this to work. Iam basically trying to get a message only when the "M" drive is connected. It keeps coming up telling me "Block If without End If" that way I see it I have and End If statement after every If statement.
Any help would be appreciated.
Sub Test()
Dim fs, d, dc, s, n
Set fs = CreateObject("Scripting.FileSystemObject")
Set dc = fs.Drives
For Each d In dc
'If d.DriveType = 3 Then
' n = d.volumeName
'End If
If d.driveletter = "A" Or "B" Or "C" Or "D" Or "E" Or "F" Or "G" Or "H" Then
MsgBox "This is not the right drive", vbCritical, "Failed"
Else
If d.driveletter = "M" Then
MsgBox "The M Drive was found", vbExclamation, "Success"
End If
'Next
End Sub