Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Codes for FileSystemObject

Status
Not open for further replies.

Karl Blessing

Programmer
Feb 25, 2000
2,936
US
when using CopyFile, or CreateFolder, they dont return error code, instead they raise them, which makes it kind of hard for me to trap the exact line the error happens on, I want to make it so I can test and see if it was sucessful or not, I loop through a collection of Script commands, and if the command wasnt sucessfull I want to assign the Failed property to true, but If I do an On erorr goto whatever, I never know what line had the error, and if I did an On Error Resume Next?, does that clear the err? <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
 
Have you tried multiple on error gotos? <p>Steve<br><a href=mailto:tribesaddict@swbell.net>tribesaddict@swbell.net</a><br><a href= > </a><br>
 
I havent tried multiple error thing, but what would be beneficial, if I knew the Error # for certain error returns, that those commands would generate, that way I can at least do a resume next, but check the err.number <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
 
You can get the error numbers from err object.&nbsp;&nbsp;Set a break point in the error handler, then when it breaks from an error, drop to the immedeate window and type:<br><br>? Err.Number<br><br>Then build your Select Case statement in your error handler from the numbers you get from trying different things.&nbsp;&nbsp;Works for me in a pinch.&nbsp;&nbsp;I checked the Object viewer and it doesn't show the error constants for the object. <p>Steve<br><a href=mailto:tribesaddict@swbell.net>tribesaddict@swbell.net</a><br><a href= > </a><br>
 
I usually run with &quot;Break on *all* errors&quot; set in Tools/Options - would that help? <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>Please -- Don't send me email questions without posting them in Tek-Tips as well. Better yet -- Post the question in Tek-Tips and send me a note saying "Have a look at so-and-so in the thingy forum would you?"
 
not during production time(release to customers) but I see your point, it would be more helpful if MSDN had the list of these code, I could test for one of them, but I am unsure about all the errors that could occur with just one of their commands. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
 
I managed to find error codes 58, 53, 76, and 70 to be for my file erros, heres the list of system error codes (0-512) excluding the sections for user-defined error codes.<br><br><FONT FACE=monospace><br>3 Return without GoSub<br>5 Invalid procedure call or argument<br>6 Overflow<br>7 Out of memory<br>9 Subscript out of range<br>10 This array is fixed or temporarily locked<br>11 Division by zero<br>13 Type mismatch<br>14 Out of string space<br>16 Expression too complex<br>17 Can't perform requested operation<br>18 User interrupt occurred<br>20 Resume without error<br>28 Out of stack space<br>35 Sub or Function not defined<br>47 Too many DLL application clients<br>48 Error in loading DLL<br>49 Bad DLL calling convention<br>51 Internal error<br>52 Bad file name or number<br>53 File not found<br>54 Bad file mode<br>55 File already open<br>57 Device I/O error<br>58 File already exists<br>59 Bad record length<br>61 Disk full<br>62 Input past end of file<br>63 Bad record number<br>67 Too many files<br>68 Device unavailable<br>70 Permission denied<br>71 Disk not ready<br>74 Can't rename with different drive<br>75 Path/File access error<br>76 Path not found<br>91 Object variable or With block variable not set<br>92 For loop not initialized<br>93 Invalid pattern string<br>94 Invalid use of Null<br>96 Unable to sink events of object because the object is already firing events to the maximum number of event receivers that it supports<br>97 Can not call friend function on object which is not an instance of defining class<br>98 A property or method call cannot include a reference to a private object, either as an argument or as a return value<br>321 Invalid file format<br>322 Can't create necessary temporary file<br>325 Invalid format in resource file<br>380 Invalid property value<br>381 Invalid property array index<br>382 Set not supported at runtime<br>383 Set not supported (read-only property)<br>385 Need property array index<br>387 Set not permitted<br>393 Get not supported at runtime<br>394 Get not supported (write-only property)<br>422 Property not found<br>423 Property or method not found<br>424 Object required<br>429 ActiveX component can't create object<br>430 Class does not support Automation or does not support expected interface<br>432 File name or class name not found during Automation operation<br>438 Object doesn't support this property or method<br>440 Automation error<br>442 Connection to type library or object library for remote process has been lost. Press OK for dialog to remove reference.<br>443 Automation object does not have a default value<br>445 Object doesn't support this action<br>446 Object doesn't support named arguments<br>447 Object doesn't support current locale setting<br>448 Named argument not found<br>449 Argument not optional<br>450 Wrong number of arguments or invalid property assignment<br>451 Property let procedure not defined and property get procedure did not return an object<br>452 Invalid ordinal<br>453 Specified DLL function not found<br>454 Code resource not found<br>455 Code resource lock error<br>457 This key is already associated with an element of this collection<br>458 Variable uses an Automation type not supported in Visual Basic<br>459 Object or class does not support the set of events<br>460 Invalid clipboard format<br>461 Method or data member not found<br>462 The remote server machine does not exist or is unavailable<br>463 Class not registered on local machine<br>481 Invalid picture<br>482 Printer error<br></font><br><br>Hopefully some of you out there might be able to use this, this is the code I used to get them.<br>(wrote to a file so I could cut/paste)<br><br><FONT FACE=monospace><br>Private Sub cmdSA_Click()<br>On Error GoTo SARet<br>List1.Clear<br>Dim errstr As String<br>Set errtxt = fs.OpenTextFile(&quot;C:\temp\err.txt&quot;, ForWriting, True)<br>Dim j As Integer<br>For j = 1 To 512<br>&nbsp;&nbsp;&nbsp;Err.Raise j<br>Next j<br>errtxt.Close<br>Exit Sub<br>SARet:<br>If Err.Description &lt;&gt; &quot;Application-defined or object-defined error&quot; Then<br>&nbsp;&nbsp;&nbsp;errstr = Err.Number & &quot; &quot; & Err.Description<br>&nbsp;&nbsp;&nbsp;errtxt.WriteLine errstr<br>End If<br>Err.Clear<br>Resume Next<br>End Sub<br></font><br> <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top