• fso error, it ran before (excel 2003, windows vista)

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » fso error, it ran before (excel 2003, windows vista)

    Author
    Topic
    #453084

    I am running this macro and it keeps stopping at the Dim fso As New FileSystemObject and won’t run. It used to run before but now it won’t. What can i do to get around it? thanks

    I get the error “compile error User-defined type not defined”

    Private Sub cmdRun_Click()
    Dim mBk As Workbook
    Dim dBk As Workbook
    Dim mSht As Worksheet
    Dim dSht As Worksheet
    Dim oSht As Worksheet
    Dim dRng As Range
    Dim fName As String
    Dim dPath As String
    Dim dCol As Integer
    Dim qText As String
    Dim brand As String
    Dim qRow As Integer
    Dim dRow As Long
    Dim oRow As Integer
    Dim oCol As Integer
    Dim sText As String
    Dim c As Integer
    Dim d As Integer
    Dim e As Integer
    Dim f As Integer
    Dim fso As New FileSystemObject

    Set mBk = ActiveWorkbook
    Set mSht = ActiveSheet
    fName = mSht.Range(“dFile”).Value
    dPath = ActiveWorkbook.Path & Chr$(92) & mSht.Range(“dFolder”).Value & Chr$(92)
    dCol = mSht.Range(“dCol”).Value
    Set oSht = mBk.Sheets(“D1”)
    oSht.Range(“clear”).ClearContents

    c = 1
    qRow = oSht.Range(“Q_” & c).Row
    d = 1
    While fso.FileExists(dPath & fName & c & “.xls”)

    Viewing 0 reply threads
    Author
    Replies
    • #1120606

      Select Tools | References… (in the Visual Basic Editor)
      Make sure that the check box for Microsoft Scripting Runtime is ticked.

    Viewing 0 reply threads
    Reply To: fso error, it ran before (excel 2003, windows vista)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: