Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 23rd, 2008, 12:43 PM   #1
Abyss
Newbie
 
Join Date: Apr 2005
Posts: 18
Rep Power: 0 Abyss is on a distinguished road
FileSystemObject

Hello All, I was wondering if someone could help explain this piece of VB code to me? I've read about the FileSystemObject online but the 'rfs' function is a bit confusing. Any help is appreciated.

Thanks

Function rfs(filespec)
  Dim fso, Msg
  Set fso = CreateObject("Scripting.FileSystemObject")
  If (fso.FileExists(filespec)) Then
    Msg = "YES"
  Else
    Msg = "NO"
  End If
  rfs = Msg
End Function
Abyss is offline   Reply With Quote
Old Mar 23rd, 2008, 12:52 PM   #2
Abyss
Newbie
 
Join Date: Apr 2005
Posts: 18
Rep Power: 0 Abyss is on a distinguished road
Re: FileSystemObject

Actually, I understand that the rfs function is taking in say, a string like for example C:Windows\Notepad.exe"and it's checking if that file exists...just not sure about the

Set fso = CreateObject("Scripting.FileSystemObject")

Hmm...
Abyss is offline   Reply With Quote
Old Mar 23rd, 2008, 8:57 PM   #3
null_ptr0
11 years old
 
Join Date: Nov 2007
Posts: 79
Rep Power: 1 null_ptr0 is on a distinguished road
Re: FileSystemObject

Scripting.FileSystemObject is an activex control object, and the function returns whether or not the argument filespec exists.
it should be (i believe):
Function rfs(ByVal filespec As String) As String
  Dim fso, Msg
  Set fso = CreateObject("Scripting.FileSystemObject")
  If (fso.FileExists(filespec)) Then
    Msg = "YES"
  Else
    Msg = "NO"
  End If
  rfs = Msg
End Function
__________________
iload_0 iconst_1 ishl or
iload_0 iconst_2 idiv or
iload_0 iconst_2 iconst_1 imul idiv
[1] & [2] use the smallest stack size
null_ptr0 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:04 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC