File System Object Syntax

Discussion in 'Software' started by ceal21c, Aug 4, 2006.

  1. ceal21c

    ceal21c Private E-2

    Hey Guys,

    I am trying to add a file search function to a program. When I try to use the code below I get a "Compile error: User-defined type not defined".

    Public Function FindInvoicesPRN()

    Dim fso As New FileSystemObject

    If fso.FileExists("C:\RS5\POS\DATA\invoices.prn") Then
    MsgBox "File Exists!"

    End If

    End Function

    What am I leaving out?
     
  2. ceal21c

    ceal21c Private E-2

    Got it. Missing Microsoft Scripting Runtime Reference.
     
  3. matt.chugg

    matt.chugg MajorGeek

    From one of my snippets files from years ago

    Code:
    Public Function File_Exists(nFile As String) As Boolean
        Dim fs
    
        Set fs = CreateObject("Scripting.FileSystemObject")
    
        File_Exists = fs.fileexists(nFile)
    End Function
    
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds