daluu
-
Total Posts
:
53
- Scores: 0
-
Reward points
:
0
- Joined: 4/17/2006
-
Status: offline
|
Better COM Object error/exception handling through JScript + WSH (over VBScript)
Monday, April 17, 2006 9:07 AM
( permalink)
I just wanted to pass this along in case anyone else is interested or encounters the same problem. Please link to the other forum topic areas, if deemed appropriate. While working on a Word automation project, I found that VBScript does not offer the necessary error handling required when a COM object (Word object in my case) throws an error/exception. Unfortunately, not all COM objects themselves will output an error message, etc. So in my case, depending on the type of error, I might not know that an error occurred and in any case, the Word object still resided in memory because I could not catch the object error using On Error Resume Next + the Err object (which only works for VBScript's default objects and the VBScript language). Standard Visual Basic and VBA might be better though with their additional error handling options. So if anyone is using WSH and COM objects or Office objects, I "highly" recommend using JScript over VBScript since JScript's try/catch block will catch the object's error no matter what happens.
|
|
|
|
ebgreen
-
Total Posts
:
8219
- Scores: 98
-
Reward points
:
0
- Joined: 7/12/2005
-
Status: offline
|
RE: Better COM Object error/exception handling through JScript + WSH (over VBScript)
Monday, April 17, 2006 9:15 AM
( permalink)
Even though it may get my Mod priveleges revoked, I will state on the record that I think JScript is a better scripting language for most tasks than VBScript. I however do not have the option of using it at work so I learned VBScript much more thoroughly.
|
|
|
|
mbouchard
-
Total Posts
:
2110
- Scores: 29
-
Reward points
:
0
- Joined: 5/15/2003
- Location: USA
-
Status: offline
|
RE: Better COM Object error/exception handling through JScript + WSH (over VBScript)
Tuesday, April 18, 2006 1:36 AM
( permalink)
ORIGINAL: ebgreen Even though it may get my Mod priveleges revoked, I will state on the record that I think JScript is a better scripting language for most tasks than VBScript. I however do not have the option of using it at work so I learned VBScript much more thoroughly. That's it, you can no longer be a mod, turn in your badge and gun....
Mike For useful Scripting links see the Read Me First stickey! Always remember Search is your friend.
|
|
|
|