I am opening up a dir to list the files in a MSFlexGrid. Then I am selecting which photo to use, but when I click on the MSFlexGrid line to select the photo, I get an Open File error.
So how do I close the FileSystemObject?
Private Sub Command4_Click() 'Search photos
Dim FSO As FileSystemObject
Dim MyFolder As folder
Dim MyFile As File
Set FSO = New FileSystemObject
Set MyFolder = FSO.GetFolder("C:\Pictures\"
For Each MyFile In MyFolder.Files
MSFlexGrid2.AddItem "" & MyFile & vbTab
Next MyFile
Set FSO = Nothing
End Sub
So how do I close the FileSystemObject?
Private Sub Command4_Click() 'Search photos
Dim FSO As FileSystemObject
Dim MyFolder As folder
Dim MyFile As File
Set FSO = New FileSystemObject
Set MyFolder = FSO.GetFolder("C:\Pictures\"
For Each MyFile In MyFolder.Files
MSFlexGrid2.AddItem "" & MyFile & vbTab
Next MyFile
Set FSO = Nothing
End Sub