Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Better COM Object error/exception handling through JScript + WSH (over VBScript)

 
Logged in as: Guest
arrSession:exec spGetSession 2,7,33564
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [General Forum] >> Other Programming/Scripting Languages >> Better COM Object error/exception handling through JScript + WSH (over VBScript)
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Better COM Object error/exception handling through JScr... - 4/17/2006 8:07:47 AM   
  daluu

 

Posts: 26
Score: 0
Joined: 4/17/2006
Status: offline
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.
 
 
Post #: 1
 
 RE: Better COM Object error/exception handling through ... - 4/17/2006 8:15:03 AM   
  ebgreen


Posts: 4595
Score: 29
Joined: 7/12/2005
Status: offline
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.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to daluu)
 
 
Post #: 2
 
 RE: Better COM Object error/exception handling through ... - 4/18/2006 12:36:39 AM   
  mbouchard


Posts: 1804
Score: 12
Joined: 5/15/2003
From: USA
Status: online
quote:

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.

(in reply to ebgreen)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [General Forum] >> Other Programming/Scripting Languages >> Better COM Object error/exception handling through JScript + WSH (over VBScript) Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts