The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

previousPrevious article   Next articlenext back to categoryVBA articles

article Tips On Getting VBA Bugs To Bug-off

Leave behind the frustration of problematic code by taking a look at this article that reveals how you can get the best from your VBA commands.
Improving your Visual Basic for Applications (VBA) skills could be a challenge if the code you've written just won't seem to work, though there are several ways you can get around these issues.

Many PC users decide to commit themselves to learning computer programming through VBA in order to get more out of the Microsoft programmes they currently use. You may have taken similar steps for a variety of reasons. A popular motivation to grab the bull by the horns and learn about this software is a simple need to reduce the amount of time you spend on repetitive tasks.

In this instance VBA gives you the means to automate functions so your time isn't filled up with completing the same jobs over and over again. For example, you may have to spend a large part of your day writing similar letters that have minor changes within the text in each document. VBA lets you write code to ensure that you simply have to press one button to create these similar-looking files, so for each one you just need to make the minor changes.

In addition to adding functions to lots of applications, including Outlook, Excel and PowerPoint among others, you can also make these kinds of files more interactive, and add extra tools that see information being presented to computer users if they click on certain fields in the documents. If you want info automatically moved from your Outlook account to a Word file, then VBA code can help these applications to 'talk' to each other and get tasks such as these completed more quickly.

So, after you've put some thought into perfecting the programmes you commonly use either by automating requests, boosting interactivity and coming up with code ideas that get different applications working together you may hit a brick wall when they don't actually work. It's important at this stage not to give up as there's lots of help available within the programme itself and from other sources. VBA has an inbuilt capacity to highlight written errors in code and to draw attention to problems that stop the programme from becoming a working command.

Syntax errors are those that result when the code has been written in the wrong grammatical format. If your code fails to have the desired effect then take a look at the Visuals Basic Editor and it should highlight in yellow the parts of the command that are incorrect. If this does not happen then you may have a runtime error on your hands, meaning syntax-wise everything appears correct.

In this instance, you will get an alert that helps you to determine which part of the code is responsible for the problem. If there are multiple problems or you still have difficulty applying the code, then it could be a good idea to break it down into smaller parts. As you slowly re-build it, you ought to test each part works individually, as this may help to pinpoint all the problems.

Another tip is to look online to find similar programmes written by others. It's wise to make sure the data comes from a trusted source and to pick samples of code that aim to do the same job as the one you've written. In addition, some computer users like to make use of specialised VBA forums where they can pose questions and get further tips on code writing, while others attend training courses to learn more about the subject.

Author is a freelance copywriter. For more information on access vba training, please visit http://www.microsofttraining.net


Original article appears here:
http://www.microsofttraining.net/article-1198-tips-on-getting-vba-bugs-bugoff.html


Back to article list

Distribution notes

PUBLICATION GUIDELINES

  • You have permission to publish this article for free providing the "About the Author" box is included in its entirety.
  • Do not post/reprint this article in any site or publication that contains hate, violence, porn, warez, or supports illegal activity.
  • Do not use this article in violation of the US CAN-SPAM Act. If sent by email, this article must be delivered to opt-in subscribers only.
  • If you publish this article in a format that supports linking, please ensure that all URLs and email addresses are active links, without the rel='nofollow' tag.
  • Software Training London Ltd. owns this article. Please respect the author's copyright and above publication guidelines.
  • If you do not agree to these terms, please do not use this article.

Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard