Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Thanked 1 Time in 1 Post

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

    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")

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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

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

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts