none
Scripting.FileSystemObject anomaly RRS feed

  • Question

  • I have used the " dim fso as Scripting.FileSystemObject" followed by " Set Fst = CreateObject("FileSystemObject") successfully in several places in an application.

    However, in the following code, taken directly from the msdn help articles, it gives an error 429 on the "Set fso " line.

    Can anyone see into this problem?  

    Private Sub ShowDriveList()
    Dim fso As Scripting.FileSystemObject
    Dim d, dc, s, n
    Set fso = CreateObject("Scripting.FileSytemObject")  'it never gets beyond this line
    Set dc = fso.Drives
    For Each d In dc
        s = s & d.DriveLetter & " - "
        If d.DriveType = "Remote" Then
            n = d.ShareName
        Else
            n = d.VolumeName
        End If
        s = s & n & vbCrLf
    Next
    MsgBox s

    End Sub

    Thank you.

    Marj Weir

    Tuesday, February 16, 2016 12:37 AM

Answers

  • You misspelled FileSystemObject in your call to CreateObject.

    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

    • Marked as answer by Marj Weir Tuesday, February 16, 2016 5:46 AM
    Tuesday, February 16, 2016 4:09 AM

All replies

  • Correction: I mistyped the Set fso as fst above, but it is correct in the code.
    Tuesday, February 16, 2016 12:39 AM
  • You misspelled FileSystemObject in your call to CreateObject.

    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

    • Marked as answer by Marj Weir Tuesday, February 16, 2016 5:46 AM
    Tuesday, February 16, 2016 4:09 AM
  • OMG!  I must have looked at that 50 times.  

    Thanks so much.

    Gotta get that eye transplant.

    Marj Weir

    Tuesday, February 16, 2016 5:46 AM