Re: bad file name error #52
No idea cuz i dont see anything wrong. Have you tried restarting the IDE?
vb Code:
Option Explicit
Private Declare Function GetLogicalDriveStrings Lib "kernel32.dll" Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Declare Function GetDriveType Lib "kernel32.dll" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Const DRIVE_REMOVABLE As Long = 2
Private Sub Form_Load()
Dim szDrivesBuff As String, lRet As Long, szDrives() As String, nIndx As Integer, nDrvIndex As Integer, szRemDrives() As String
nDrvIndex = 0
szDrivesBuff = Space(255)
lRet = GetLogicalDriveStrings(Len(szDrivesBuff), szDrivesBuff)
szDrivesBuff = Left(szDrivesBuff, lRet)
szDrives() = Split(szDrivesBuff, Chr(0))
For nIndx = 0 To UBound(szDrives()) Step 1
If (GetDriveType(szDrives(nIndx)) = DRIVE_REMOVABLE) Then
If (szDrives(nIndx) <> "A:\") Then
ReDim Preserve szRemDrives(nDrvIndex)
szRemDrives(nDrvIndex) = szDrives(nIndx)
nDrvIndex = nDrvIndex + 1
End If
End If
Next nIndx
End Sub
Re: bad file name error #52
Found it. It was in my drive type
replaced this
sDriveName = GetDriveType(sDrive & ":\")
with
sDriveName = sDrive & ":\"
This was incorrect as a solutation
How do i unresolve this question ?
Re: bad file name error #52
Just noticed that the function has no line number past 90, but that does not solve the problem, the erorr still happens just not on that line