Results 1 to 12 of 12

Thread: Program used to work fine,not anymore

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    29

    Question Program used to work fine,not anymore

    This program used to work fine once upon a time but when i tried running it again recently it gave me an error Compile error: User defined type not defined.Anyone has any idea why this happened? Please do me a favor n try running it for me on ur pc and c whether it gives u any problem. Please put and END at the end of this program because the box doesnt close automatically when it finishes wid the purging job.I have to manually close it.Please convert it to an exe once u r done.Thank you so much!
    Attached Files Attached Files
    Last edited by harjit; Aug 2nd, 2005 at 09:11 PM.

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    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.

  3. #3
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Program used to work fine,not anymore

    harjit,

    Don't use END use Unload Me

  4. #4
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Program used to work fine,not anymore

    Reference Microsoft Scripting RunTime and try using this...

    VB Code:
    1. Dim fso As FileSystemObject
    2. Set fso = New FileSystemObject
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  5. #5

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    29

    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

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Program used to work fine,not anymore

    Quote 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.

  7. #7
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 2002
    Location
    Nottingham
    Posts
    2,176

    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
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  8. #8

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    29

    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:
    1. Private Sub Form_Activate()
    2. Dim fso As New FileSystemObject
    3. Dim RootPath As String
    4. Dim Report As String
    5. Dim Path As String
    6. Dim KeepDay As Integer
    7. Dim root As Folder
    8. Dim Fol1 As Folder
    9. Dim Fol2 As Folder
    10. Dim Fol3 As Folder
    11. Dim File1 As File
    12. Dim File2 As File
    13. Dim vStart As Date
    14. Dim vEnd As Date
    15. Dim DelNum As Long
    16. DelNum = 0
    17. vStart = Now
    18. RootPath = "C:\Xfiles\WIPFS\_AccMgr\Thruput\"
    19. Open App.Path & "\Parameter.txt" For Input As #1
    20. Do Until (EOF(1) = True)
    21.     KeepDay = 0
    22.     Input #1, KeepDay
    23. Loop
    24. Close #1
    25. Open App.Path & "\DeletedFile.txt" For Output As #2
    26.   Set root = fso.GetFolder(RootPath)
    27.   For Each Fol1 In root.SubFolders
    28.     Set Fol2 = fso.GetFolder(RootPath & Fol1.Name)
    29.       For Each File1 In Fol2.Files
    30.         If DateDiff("d", File1.DateLastModified, Date) > KeepDay Then
    31.            Print #2, RootPath & Fol1.Name & "\" & File1.Name, DateDiff("d", File1.DateLastModified, Date)
    32.            [B]lblFile.Caption = RootPath & Fol1.Name & "\" & File1.Name[/B]  
    33.            fso.CopyFile RootPath & Fol1.Name & "\" & File1.Name, _
    34.                 RootPath & Fol1.Name & "\Archive\" & File1.Name, True
    35.            fso.DeleteFile RootPath & Fol1.Name & "\" & File1.Name
    36.            DelNum = DelNum + 1
    37.         End If
    38.         DoEvents
    39.       Next
    40.   Next
    41.   Close #2
    42.   Open App.Path & "\ArchParameter.txt" For Input As #3
    43.     Do Until (EOF(3) = True)
    44.     KeepDay = 0
    45.     Input #3, KeepDay
    46. Loop
    47. Close #3
    48. Open App.Path & "\DeletedArchFile.txt" For Output As #4
    49.   Set root = fso.GetFolder(RootPath)
    50.   For Each Fol1 In root.SubFolders
    51.     Set Fol2 = fso.GetFolder(RootPath & Fol1.Name)
    52.       For Each File1 In Fol2.Files
    53.         If DateDiff("d", File1.DateLastModified, Date) > KeepDay Then
    54.            Print #4, RootPath & Fol1.Name & "\" & File1.Name, DateDiff("d",   File1.DateLastModified, Date)
    55.            lblFile.Caption = RootPath & Fol1.Name & "\" & File1.Name
    56.            fso.DeleteFile RootPath & Fol1.Name & "\Archive\" & File1.Name
    57.            DelNum = DelNum + 1
    58.         End If
    59.         DoEvents
    60.       Next
    61.   Next
    62.   Close #4
    63. vEnd = Now
    64. Open App.Path & "\ExecutionLog.txt" For Append As #1
    65. Print #1, "Start: " & vStart, "End: " & vEnd, "Successfully Delete " & DelNum & " Files."
    66. Close #1
    67. End Sub

  9. #9
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    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?

  10. #10

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    29

    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?

  11. #11
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 2002
    Location
    Nottingham
    Posts
    2,176

    Re: Program used to work fine,not anymore

    Do you not have to set file1 before trying to find its name
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  12. #12

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    29

    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
  •  



Click Here to Expand Forum to Full Width