Tips and Tricks of Error Handling in VBScript or in UFT

Spread the love
  • 24
  • 28
  • 12
  • 23

Option Explicit also refers to a variable that has not been declared. So if we get a runtime error for option explicit statement that “variable is undefined”.We need to check the declaration of the variables.

Example of Error due to Option Explicit

Option Explicit
Dim index
For index=0 to 10
If(index=5) Then
Msgbox myVar
msgbox index
End If

This code will work fine till Index=4. As soon as the index becomes 5, the VBScript engine will throw an error stating myVar variable is undefined. Now if we examine our code carefully, we can see the variable myVar has never been declared.

When running a script,Option Explicit is neutralized and error is not caught but if a general error handler module is available, it will help us to defect the error and where the error has occurred.

How to avoid the Runtime Error

Since Runtime is critical than Syntax error, we need to understand how to avoid a Runtime error. Below are the guideline to avoid the runtime error.

  • We need to be well versed with VBScript syntax, rules.
  • We need to carefully read the documentation for functions or sub before working with them.
  • If we get some different, not so well stated error messages or errors like Unspecified errors or Operations aborted or Error occurred etc. we need to surrender to Google. Daddy google has all kind of answer for any sort of problem.
  • The last option is to use a trial and error method. Once we get the different type of solutions from Google we need to apply these techniques in our script.
  • We need to use comments while we fix those errors so that we can later understand the purpose of the code we just inserted to our script.
Common Runtime Errors with Error Code and Description


Hexadecimal Error Code Decimal Error Code Comments
800A0005 5 “Invalid procedure call / Invalid argument” error.
800A0006 6 “Stack overflow” error.
800A0007 7 “Out of memory” error.
800A0009 9 “SubScript out of Range” error.
800A000A 10 Array related error -“already locked or fixed” error.
800A000B 11 “Division by zero” error.
800A000D 13 “Type mismatch” error
800A000E 14 “String out of space” error.
800A0011 17 “Can’t perform requested operation” error.
800A001C 28 “Stack out of space” error.
800A01A8 424 “Object required” error
800A01AD 429 “ActiveX component can’t create object” error.
800A01AE 430 “Class doesn’t support Automation” error.
800A01B0 432 “Filename or class name not found during
Automation operation” error.
800A0023 35 “Function or sub not defined” error.
800A0030 48 “Error in loading DLL” error
800A0033 51 “Internal” error
800A01B6 438 “Object doesn’t support this property or method” error.
800A01BD 445 “Object doesn’t support this action” error.
800A01BF 447 “Object doesn’t support current locale setting” error.
800A01C0 448 “Named argument not found” error.
800A01C1 449 “Argument not optional” error.
800A01C2 450 “Wrong number of arguments or invalid property assignment” error
800A01C3 451 “Object not a collection” error.
800A01CA 458 “Variable uses an Automation type not supported in VBScript” error.
800A01CE 462 “Remote server machine does not exist or is unavailable” error.
800A01E1 481 “Invalid picture” error.
800A01F4 500 “Variable is undefined” error.
800A01F6 502 “Object not safe for scripting” error.
800A005B 91 “Object variable not set” error.
800A005E 94 “Invalid use of Null” error
800A005C 92 “For loop not initialized” error
800A01F7 503 “Object not safe for initializing” error.
800A01F8 504 “Object not safe for creating” error.
800A01F9 505 “Invalid or unqualified reference” error.
800A01FA 506 “Class not defined error”.
800A01FB 507 “An exception occurred error.
800A1390 5008 “Illegal assignment” error.
800A1399 5017 “Syntax error in regular expression”
800A139A 5018 “Unexpected quantifier” error
800A139B 5019 Expected ‘]’ in regular expression error.
800A139C 5020 “Expected  ‘)’ in regular expression” error.
800A139D 5021 “Invalid range in character set” error.
800A0034 52 “Bad file name number” error.
800A0035 53 “File not found” error.
800A0036 54 “Bad file mode” error.
800A0037 55 “File already open” error.
800A0039 57 “Device I/O error” error.
800A003A 58 “File already exists” error.
800A003D 61 “Disk full” error.
800A003E 62 “Input past end of file” error.
800A0043 67 “Too many files” error.
800A0044 68 “Device unavailable” error.
800A0046 70 “Permission denied” error.
800A0047 71 “Disk not ready” error.
800A004A 74 “Can’t rename with different drive” error.
800A004B 75 “Path/File access error” error.
800A004C 76 “Path not found” error.
800A0142 322 “Can not create necessary temporary file” error.
800A01B8 440 “Automation” error.
800A01BE 446 “Object does not support named arguments” error.
800A01C5 453 “Specified DLL function not found” error.
800A01C7 455 “Code resource lock error” error.
800A01C9 457 “This key is already associated with an element of this collection” error.
800A01F5 501 “Illegal assignment” error.
800A1398 5016 “Regular expression object required” error.
800A802B 32811 “Element not found” error.

Logic Errors

Logic errors are very tough to determine especially if a person debugs who never wrote the script. Logic errors are hidden inside our code and generally do not have a User Interface to show up. The only area we understand logic error when the piece of the code generates a wrong output. The output is different from what is desired.Otherwise we can say that logic errors are bugs of the application.

How to avoid logic errors?

  • We need to read the design specification, requirement documentation to understand the functionality and then inspect the code if that is doing what it is suppose to do.
  • We need to follow “Divide and Develop” principal and implement stub and drivers in order to design our script sequentially correct.
  • Check the code logic while using operators. or sendkeys.
  • Use Custom runtime in different places.
  • Testing is important to detect the logic errors.

How to handle VBScript Errors in UFT or VBScript Editor?

VBScript does not support try-catch block to handle the error or exceptions, instead, it supports to provide a Global error handling mechanism. However once the error occurs, VBScript engines invokes it’s internal error handling mechanism.

Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 24
  • 28
  • 12
  • 23


  1. What’s up, alwayѕ i used to check webpage posts here early in the morning, since i enjoy to learn more and more.

  2. Ꮋіya! I know this is kinda off topic but I’d figuгed I’d ask.

    Would you be interested in trading links or maybe ɡuеst writing
    a blog article or vice-versa? My site covers a lot of the
    same topics as yours and I think we could greatly benefit fгom each
    otһer. If you might be interested feel free tօ shoot me an email.
    I look forward to һeɑring from you! Ƭerrific blog by the way!

  3. Is primary goal of company earning huge returns?
    Your clients will for you to see the same internet website layout.
    Pick 10-20 publications of one’s topic region and change them in to a

    • IsidraFitzmaurice95, Thank you. I am really not looking for huge profit as of right now. I just want to make the website reach in terms of knowledge sharing. However I will surely keep your comment in mind.


  4. I have been browsing online more than 4 hours today, yet I never found any
    interesting article like yours. It’s pretty worth enough for me.
    Personally, if all webmasters and bloggers made good content
    as you did, the web will be much more useful than ever before.
    Howdy! This blog post could not be written any
    better! Looking through this post reminds me of my previous roommate!
    He always kept talking about this. I’ll send this post to him.
    Fairly certain he’s going to have a very good read.

    Thanks for sharing! Howdy just wanted to give you a quick heads up.

    The text in your article seem to be running off the screen in Chrome.
    I’m not sure if this is a formatting issue or something
    to do with internet browser compatibility but I thought
    I’d post to let you know. The design and style look great though!
    Hope you get the problem solved soon. Kudos

  5. Wow! This blog looks exactly like my old one! It’s on a completely different topic but it has pretty
    much the same layout and design. Excellent choice of colors!
    Hello just wanted to give you a quick heads up. The words in your content seem to be running off the screen in Opera.
    I’m not sure if this is a format issue or something to do with web browser
    compatibility but I figured I’d post to let you know.
    The style and design look great though! Hope you get the issue
    resolved soon. Thanks Woah! I’m really digging the template/theme of this site.

    It’s simple, yet effective. A lot of times it’s very difficult to get that “perfect balance”
    between user friendliness and visual appearance.
    I must say you have done a fantastic job with this.
    In addition, the blog loads very quick for me on Opera.
    Superb Blog!

    • Hello Chrinstine,
      I have not checked in Opera till now. Now I got this as a requirement. Surely I will look into this issue. I will rectify if I can.I would suggest to look it at chrome and mozilla.
      Thanks your kind words. It means a lot for a budding blogger like me.


  6. It’s really a great and useful piece of information. I’m glad that you
    simply shared this helpful info with us. Please keep us informed
    like this. Thank you for sharing.

  7. I was curious if you ever thought of changing the layout of your site?
    Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content so
    people could connect with it better. Youve got an awful lot of text for only having 1 or 2 pictures.

    Maybe you could space it out better?

  8. Wonderful items from you, man. I’ve understand your stuff prior to and you’re simply too wonderful.
    I really like what you’ve acquired right here, really like
    what you are stating and the way in which during which you
    are saying it. You’re making it enjoyable and you continue to care for to stay it sensible.
    I cant wait to learn far more from you. That is actually a tremendous web

  9. Wоnderful article! This iѕ the kind of info that should be
    shared aroսnd the net. Shame on the sеek engines for not positioning this submit higher!
    Come on over and seek ɑdѵice from mʏ site .
    Ꭲһanks =)

  10. There has been a lot of fuss about SEO or search
    engine optimization. Some would say it would take months and even years to
    be one important the search engines even though some even claim it would certainly
    be just a matter of weeks for you to view results and dominate Google which
    is which?

    Link exchanging with other blogs in which in equivalent market as yours.
    You are unable to want any that price range direct competition with remember.
    This can help you out if these linked sites have a good page ranking in Google
    or other popular search engines.

    The success of your article really depends onto your headline (title).

    This just what the user sees . Make sure you grab their undivided attention so they will want to read
    your article. 75% of as well as effort writing your article often be spent on creating a title.

    Without a successful page, positive if you find it difficult to
    make quick money online. The landing page is come into making cash.

    Don’t give poor effort in completing this method. It is a substantial reason for the downfall many Internet marketing

    You are afraid to be an expert on google marketing added with these techniques either.
    A person have know basic HTML, you’ll be able to can implement these goes.

    So maybe you should activate with just adding say Meta tags and seeing
    how that gets an outcome when copy and paste a associated with your
    pages text within a search locomotive. Then change the Meta tags to another thing and re-submit your
    pages to figure out. Next time you execute a search
    the new same keyword and key phrase as before, you will have a choice of could be getting
    you the best information.

    Email marketing or advertising. Some online users do don’t
    have much time to check your own everyday notice your
    latest offerings. Bring the content to them, right inside mailbox by
    sending them email advertising.

    For details on the best way to resize your Headline tags and correct use of hyperlinks using
    Dreamweaver booking out our article ‘Optimizing in Dreamweaver for Dummies’.

  11. It’s awesome to pay a quick visit this website and reading the views of all friends regarding this piece of writing, while I am also keen of getting familiarity.

  12. Simply want to say your article is as astonishing. The clearness in your submit is simply nice and that i can suppose you are a professional on this subject. Fine with your permission let me to seize your feed to keep updated with approaching post. Thanks one million and please continue the rewarding work.

  13. I’m extremely impressed with your writing skills as well as with
    the layout on your blog. Is this a paid theme or did you modify it yourself?
    Anyway keep up the nice quality writing, it is rare to see a great
    blog like this one today.

  14. Heya! I know this is somewhat off-topic but I had to
    ask. Does operating a well-established blog such as yours take a
    large amount of work? I am brand new to blogging but I do write in my
    journal daily. I’d like to start a blog so I can share my experience and feelings online.
    Please let me know if you have any kind of ideas or tips
    for brand new aspiring bloggers. Thankyou!

    • Hello friend,
      I do it as part of my learning. The sole objective of this blog is to read and find out the summary and then write it here for my future reference. Now interestingly, this is helping everybody. A kind of free learning. Coming back to your original question if you prepare your blog for money, it may take few months to see actual earnings as you will be focused to post all current topics where CPC will be high. But this is not directly linked to earn money. Hence the earning is in snail’s pace.


  15. Heya great website! Does running a blog such as this
    require a lot of work? I’ve very little understanding of computer programming but I was
    hoping to start my own blog soon. Anyhow, if you have any suggestions or techniques for new blog owners please share.
    I know this is off topic nevertheless I just had to ask.
    Thanks a lot!

    • Hello friend,
      I do it as part of my learning. The sole objective of this blog is to read and find out the summary and then write it here for my future reference. Now interestingly, this is helping everybody. A kind of free learning. Coming back to your original question if you prepare your blog for money, it may take few months to see actual earnings as you will be focused to post all current topics where CPC will be high. But this is not directly linked to earn money. Hence the earning is in snail’s pace.


  16. Way cool, some valid points! I appreciate you making this article available, the rest of the site is also high quality. Have a fun.

  17. Just desire to say your article is as surprising. The clearness on your submit is simply spectacular and that i could think you are knowledgeable on this subject.
    Well together with your permission let me to clutch your feed to stay updated with drawing close post.
    Thanks 1,000,000 and please keep up the enjoyable work.kristy jager

  18. Aw, this was an exceptionally nice post. Spending some time and actual effort to make a great article?
    but what can I say? I put things off a lot and never seem to get nearly anything

  19. Thank you for the auspicious writeup. It in fact was a amusement account
    it. Look advanced to far added agreeable from you!
    However, how could we communicate? clevelandshimizu

  20. Link exchange is nothing else but it is only placing the
    other person’s weblog link on your page at suitable place and other person will also do similar in support of you.charlottehowell

  21. Well I definitely liked reading it. This information offered by you is very practical for accurate planning.alvaromei

  22. Hi there, just became alert to your blog through Google,
    and found that it is really informative. I am
    going to watch out for brussels. I’ll appreciate if you continue this in future.
    Many people will be benefited from your writing. Cheers!

  23. A person essentially lend a hand to make severely articles I might
    state. This is the very first time I frequented your web page and thus
    far? I amazed with the research you made to make this particular publish amazing.

    Fantastic activity!

  24. Howdy! I could have sworn I’ve been to this site before but after looking at many of the articles I realized it’s new to me. Anyways, I’m definitely delighted I discovered it and I’ll be book-marking it and checking back frequently!

  25. Hey there would you mind stating which blog platform you’re working with?
    I’m looking to start my own blog in the near future
    but I’m having a tough time selecting between BlogEngine/Wordpress/B2evolution and Drupal.

    The reason I ask is because your design seems different
    then most blogs and I’m looking for something
    completely unique. P.S Apologies for getting off-topic but I had
    to ask!

  26. I’m impressed, I need to say. Actually not often do I encounter a weblog that’s each educative and entertaining, and let me tell you, you could have hit the nail on the head. Your thought is excellent; the problem is something that not enough persons are speaking intelligently about. I am very completely happy that I stumbled throughout this in my search for one thing relating to this.

  27. Amazing blog! Do you have any helpful hints for aspiring writers?
    I’m hoping to start my own site soon but I’m a little
    lost on everything. Would you suggest starting with a free platform like WordPress or go for a paid option? There are so many choices out there that I’m totally overwhelmed ..

    Any suggestions? Appreciate it!

  28. My partner and I absolutely love your blog and find nearly all of your post’s to be what precisely I’m looking for. Do you offer guest writers to write content available for you? I wouldn’t mind producing a post or elaborating on many of the subjects you write about here. Again, awesome web site!

  29. I just like the helpful info you supply to your articles. I will bookmark your blog and take a look at again right here frequently. I am quite certain I’ll learn many new stuff right right here! Best of luck for the next!

  30. Whats up very nice web site!! Man .. Excellent .. Amazing .. I’ll bookmark your site and take the feeds also…I am glad to find numerous helpful info right here in the publish, we’d like develop extra techniques in this regard, thank you for sharing. . . . . .

  31. Its like you read my mind! You appear to know a lot about this, like you wrote the book in it or something. I think that you can do with a few pics to drive the message home a little bit, but other than that, this is great blog. A fantastic read. I’ll certainly be back.


Please enter your comment!
Please enter your name here