'go through specified folder and add all filenames to the listbox Dim oFileSystem As New FileSystemObject Dim oFolder As Folder Dim oCurrentFile As File Dim oFileColl As Files
Set oFolder = oFileSystem.GetFolder(“C:\Files”) Set oFileColl = oFolder.Files
If oFileColl.Count > 0 Then With lstFiles For Each oCurrentFile In oFileColl .AddItem oCurrentFile.Name 'add item Next .ListIndex = 0 End With End If
Set oFileSystem = Nothing Set oFolder = Nothing Set oFileColl = Nothing Set oCurrentFile = Nothing
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA"_ (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, _ ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Public Sub SetCDState(pbState As Boolean) If pbState Then Call mciSendString("Set CDAudio Door Open", 0&, 0&, 0&) Else Call mciSendString("Set CDAudio Door Closed", 0&, 0&, 0&) End If End Sub
Comments 7
Reply
Reply
Reply
Dim oFileSystem As New FileSystemObject
Dim oFolder As Folder
Dim oCurrentFile As File
Dim oFileColl As Files
Set oFolder = oFileSystem.GetFolder(“C:\Files”)
Set oFileColl = oFolder.Files
If oFileColl.Count > 0 Then
With lstFiles
For Each oCurrentFile In oFileColl
.AddItem oCurrentFile.Name 'add item
Next
.ListIndex = 0
End With
End If
Set oFileSystem = Nothing
Set oFolder = Nothing
Set oFileColl = Nothing
Set oCurrentFile = Nothing
Reply
(ByVal lpstrCommand As String,
ByVal lpstrReturnString As String, _
ByVal uReturnLength As Long,
ByVal hwndCallback As Long) As Long
Public Sub SetCDState(pbState As Boolean)
If pbState Then
Call mciSendString("Set CDAudio Door Open", 0&, 0&, 0&)
Else
Call mciSendString("Set CDAudio Door Closed", 0&, 0&, 0&)
End If
End Sub
Reply
Leave a comment