|
-
Aug 2nd, 2005, 08:31 PM
#1
Thread Starter
Junior Member
-
Aug 2nd, 2005, 08:42 PM
#2
Re: Program used to work fine,not anymore
Zip up your project and post it. Do you have a reference to Microsoft Scripting Runtime? That would cause an error.
-
Aug 3rd, 2005, 02:48 AM
#3
Re: Program used to work fine,not anymore
harjit,
Don't use END use Unload Me
-
Aug 3rd, 2005, 03:26 AM
#4
Re: Program used to work fine,not anymore
Reference Microsoft Scripting RunTime and try using this...
VB Code:
Dim fso As FileSystemObject
Set fso = New FileSystemObject
-
Aug 3rd, 2005, 07:51 AM
#5
Thread Starter
Junior Member
Re: Program used to work fine,not anymore
What does this mean?Reference Microsoft Scripting RunTime ? Im new to vb, so I have no idea what this means.Plz help
-
Aug 3rd, 2005, 07:58 AM
#6
Re: Program used to work fine,not anymore
 Originally Posted by harjit
What does this mean?Reference Microsoft Scripting RunTime ? Im new to vb, so I have no idea what this means.Plz help
You will find it under References. It is necessary if you wish to use the File System Object.
-
Aug 3rd, 2005, 08:33 AM
#7
KING BODWAD XXI
Re: Program used to work fine,not anymore
Load your project
On top bar go
Project --> Referances
Find the microsoft Scripting runtime and tick it
Click ok and compile it
-
Aug 5th, 2005, 03:01 AM
#8
Thread Starter
Junior Member
Re: Program used to work fine,not anymore
As soon as i thought ive completed my work thats when my codes tell me there's another problem, ive never had this problem before. It says runtime error "424" : Object Required. The line in bold is where the problem is,can someone plz figure this out for me?Thank you so much.
VB Code:
Private Sub Form_Activate()
Dim fso As New FileSystemObject
Dim RootPath As String
Dim Report As String
Dim Path As String
Dim KeepDay As Integer
Dim root As Folder
Dim Fol1 As Folder
Dim Fol2 As Folder
Dim Fol3 As Folder
Dim File1 As File
Dim File2 As File
Dim vStart As Date
Dim vEnd As Date
Dim DelNum As Long
DelNum = 0
vStart = Now
RootPath = "C:\Xfiles\WIPFS\_AccMgr\Thruput\"
Open App.Path & "\Parameter.txt" For Input As #1
Do Until (EOF(1) = True)
KeepDay = 0
Input #1, KeepDay
Loop
Close #1
Open App.Path & "\DeletedFile.txt" For Output As #2
Set root = fso.GetFolder(RootPath)
For Each Fol1 In root.SubFolders
Set Fol2 = fso.GetFolder(RootPath & Fol1.Name)
For Each File1 In Fol2.Files
If DateDiff("d", File1.DateLastModified, Date) > KeepDay Then
Print #2, RootPath & Fol1.Name & "\" & File1.Name, DateDiff("d", File1.DateLastModified, Date)
[B]lblFile.Caption = RootPath & Fol1.Name & "\" & File1.Name[/B]
fso.CopyFile RootPath & Fol1.Name & "\" & File1.Name, _
RootPath & Fol1.Name & "\Archive\" & File1.Name, True
fso.DeleteFile RootPath & Fol1.Name & "\" & File1.Name
DelNum = DelNum + 1
End If
DoEvents
Next
Next
Close #2
Open App.Path & "\ArchParameter.txt" For Input As #3
Do Until (EOF(3) = True)
KeepDay = 0
Input #3, KeepDay
Loop
Close #3
Open App.Path & "\DeletedArchFile.txt" For Output As #4
Set root = fso.GetFolder(RootPath)
For Each Fol1 In root.SubFolders
Set Fol2 = fso.GetFolder(RootPath & Fol1.Name)
For Each File1 In Fol2.Files
If DateDiff("d", File1.DateLastModified, Date) > KeepDay Then
Print #4, RootPath & Fol1.Name & "\" & File1.Name, DateDiff("d", File1.DateLastModified, Date)
lblFile.Caption = RootPath & Fol1.Name & "\" & File1.Name
fso.DeleteFile RootPath & Fol1.Name & "\Archive\" & File1.Name
DelNum = DelNum + 1
End If
DoEvents
Next
Next
Close #4
vEnd = Now
Open App.Path & "\ExecutionLog.txt" For Append As #1
Print #1, "Start: " & vStart, "End: " & vEnd, "Successfully Delete " & DelNum & " Files."
Close #1
End Sub
-
Aug 5th, 2005, 03:14 AM
#9
Re: Program used to work fine,not anymore
harjit,
You are asking us to guess with out seeing your project. Does lblFile actually exist? Do you use Option Explicit in all your forms and Modules?
-
Aug 5th, 2005, 03:28 AM
#10
Thread Starter
Junior Member
Re: Program used to work fine,not anymore
Yes, lblFile actually exist, it stands for label file, this is my program, i fired it long ago, now that I want to modify my codes and I cant do it, cause the line that I showed you keeps giving me problem. Any idea?
-
Aug 5th, 2005, 04:04 AM
#11
KING BODWAD XXI
Re: Program used to work fine,not anymore
Do you not have to set file1 before trying to find its name
-
Aug 5th, 2005, 04:11 AM
#12
Thread Starter
Junior Member
Re: Program used to work fine,not anymore
File1?Meaning?I dunt really think there's a problem wid my codes coz these r the same codes I used to purge my files,all i wanna do is put an END function right below this program, cause the only drawback this prog has is it doesnt close its window once it has completed its job.But what i dunt get is the new error that keeps popping up out of nowhere, ive mentioned it earlier in my post,plz help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|