Hallo,
versuche es mal so.
Private Declare Function SHFormatDrive Lib "shell32" _
(ByVal hwndOwner As Long, ByVal lngDrive As Long, _
ByVal lngCapacity As Long, ByVal lngFormatType As _
Long) As Long
Const SHFD_CAPACITY_DEFAULT = 0 ' Standard-Kapazität
Const SHFD_FORMAT_QUICK = 0 ' Quickformat, für NT = 1
Const SHFD_FORMAT_FULL = 1 ' Vollständig, für NT = 0
Private Sub Command1_Click()
Dim Result&, Drive&
'Laufwerk A: für C wird 2, D = 3 etc. eingesetzt
Drive = Asc("F") - 65
Result = SHFormatDrive(0, Drive, SHFD_CAPACITY_DEFAULT, SHFD_FORMAT_QUICK)
Select Case Result
Case Is > -1: MsgBox "In Ordnung"
Case -1: MsgBox ("Fehler")
Case -2: MsgBox ("Abbruch")
End Select
End Sub
Gruß Tino