some CreateObject("Scripting.FileSystemObject")

by MYLE 18. June 2010 21:16

Some handy function

Function ReportFolderStatus(fldr) As Boolean
   Dim fso, msg
   Set fso = CreateObject("Scripting.FileSystemObject")
   If (fso.FolderExists(fldr)) Then
      ReportFolderStatus = True
   Else
      ReportFolderStatus = False
   End If
   Set fso = Nothing
End Function

Function CreateFolder(FolderName)
On Error Resume Next
   Dim fso, f
   If Not ReportFolderStatus(FolderName) Then
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.CreateFolder(FolderName)
   End If
   Set fso = Nothing
End Function

Sub SaveAction(FullPathFile, FeildName, strEntry, Deleteit)
    'write the data to a log file
    If Deleteit And ReportFileStatus(FullPathFile) Then Kill FullPathFile
    Dim strErrMsg, f, fsoLog
    Set fsoLog = CreateObject("Scripting.FileSystemObject")
    Set f = fsoLog.OpenTextFile(FullPathFile, 8, True, -2)
    Outline = FeildName & ":" & strEntry
    f.WriteLine Outline
    f.Close
    Set fsoLog = Nothing
End Sub

Function ReportFileStatus(filespec)
   Dim fso, msg
   Set fso = CreateObject("Scripting.FileSystemObject")
   If (fso.FileExists(filespec)) Then
      ReportFileStatus = True
      Exit Function
   Else
      ReportFileStatus = False
      Exit Function
   End If
   Set fso = Nothing
End Function

Comments

Comments are closed

Dislexia

I see people have commented about my style of writting.
Well I have dislexia so spelling is not one of my good points
but when it comes to reading/written code thats the easy bit.

 

 

Poll

What Search Engine Do you use




Show Results

Disclaimer of Liability

While every effort will be made to ensure that the information contained within this website is accurate and up to date, The Company's listed with this web site and any associated parties, make no warranty, representation or undertaking, whether expressed or implied, nor does it assume any legal liability, whether direct or indirect, or responsibility for the accuracy, completeness, or usefulness of any information.

 

Google Ads

Most comments

apply cash advance apply cash advance
1 comments
us United States
cloudy cloudy
1 comments
us United States
mutuelle mutuelle
1 comments
fr France

RecentComments

Comment RSS