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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Forum - Beginners FAQ

VBA For Beginners

VBA Forum - Beginners FAQ

by  fumei  Posted    (Edited  )
FAQ for VBA Beginners

Visual Basic for Applications (VBA) can be scary and confusing for beginners. This is quite reasonable. It IS scary and confusing. It is also productive, fun, frustrating, fascinating, really, really dumb, oddly elegant, and wonderfully useful.

Is this a forum for beginners?. Yes, absolutely. All of us, even the MVP, started some where. There are NO dumb questions. This is not a Help Desk, so we are not here to hand solutions off to people. However, if some one is clearly making effort themselves, trying to figure things out, we (collectively) are willing to share and help out.

Use the macro recorder. This is the greatest tool you will find to get started. Frequently there are posts that get responses asking û ôDid you try recording a macro?ö This may seem a rude response. When someone asks that, it is a hint that it may be possible that the question may have a fairly straightforward answer.

The macro recorder simply records the actions you take until you stop the recorder. You should always try recording what you want to happen before you post a question. You may be surprised by what you can figure out looking at the VBA code for your recorded macros. There are quite a lot of things you may want to do that can not be done with the macro recorder. That is the way it goes. However, if you are just starting - use it.

Use Help. In the Visual Basic Editor (VBE) you can put your cursor over words and press F1, and get a lot of information. This is extremely useful looking at code your recorded. Try following through links to see if you can build more understanding of concepts and structure. In your posts let us know where you have looked for Help. Some of the concepts that come up using help may be confusing, but if you are specific about questions, we may be able to help some more.

The default install of Office does not install Help. So if it didn't you will need to go back and install it. However, it is definitely worth it. The rest of us will respond more positively to someone who is clearly trying, and willing to try, to find out how to doàwhatever it is they want to do.

Read the forum FAQs. There is a large amount of information in the forum FAQ section. It is very possible the information you are looking for is already there. Some issues come up time and time again. Some of those have an FAQ. Use them, as that it what they are there for.

Posting code. Follow the "Process TGML" link at the bottom of the post area. You can find out how to add visual aids, for example, to highlight lines that are not working. For example everything you type between "code" (but within [ and ]) and "/code" (also between [ and ]) will be in the Code boxes you see in the posts. If this is confusing, look at Process TGML.

Using some sort of highlighting in your code really makes it stand out. This helps a lot for us to see where the problem may be. When you post troubling code, point out the part that is either confusing, or seems to be giving you trouble.

Be specific - #1. If you have error messages, tell us what they say. "I get an error." is not good enough.

Application and Version. VBA has some significant differences between applications, and sometimes between application versions as well. It is good posting practice to tell us what application you are working in, and what version. Computer hardware information is rarely a factor in VBA (except for those pesky printer driversà), but if it seems relevant, by all means, post it.

Use comments in your code. Until you become extremely good, comments help both you and all of us. For you it helps to see the logic of the processes involved. For us, it shows your intentions, and gives a hint of your understanding. Knowing your intentions (which can be different from what are you are actually doing), give us a huge boost to being able to offer suggestions.

Be specific - #2. We are not mind readers, and we can not see what you are doing, what you want to do û unless you tell us. You may see posts that seem to be full of picky fussy questions about minute details. Get used to it. It is often in those details that solutions can be found. Also, a significant number of posts get extended because we do understand what the real question is.

Be specific - #3. A short concise Subject line is a large factor in getting quicker responses. ôPlease Help!!!!!!!!ö may reflect how you feel, and while we may be sympathetic, sorry, the reality is that we are busy, and we are not getting paid for this. Some of us are extremely knowledgeable in certain areas, and weaker in others. The drama of ôPlease Help!!!!ö is not helpful, however ôExcel Formula Confusion û Please Help!!!ö, while still dramatic, will catch the Excel gurus here. The Word specialists will probably let that one slide. It is the Excel specialists you want to look at your post, right? Make your subject line clear.

Be specific - #4. Be clear in your use of terms. ôMy table does not accept data properly. Can anyone tell me why?ö This may seem clear to the person posting, after all, their table is not getting data properly. To us it is almost meaningless. Is this an Access table? A text table in Word? A reference to some sort of table in Excel? Data from where?

Another example is ôtextboxö. There are a number of ôtextboxesö. Did you use the Forms toolbar to make a textbox? Did you use the Controls toolbar to make a textbox? There are differences between them, and if you tell us up front it speeds up our ability to respond. The more information we have the better. If it is some object that is troubling, tell us how you made the object.

Be specific - #5. On the other hand, please try to post only the relevant issue. Pages and pages of code may seem best û so we can see everything. However, it is better to try and post code snippets that are the problem. If we need to see more, we will ask for it. This is hard one to judge, but you will get better at it.

Post appreciations. The ôstarö thing. There are undoubtedly some for whom the star count is important. It gets your name up in the MVP list etc etc. The purpose of the star is to give appreciation to those who contribute. It also marks posts as significantly informative or helpful. So, by all means, give stars. Again, we do not get paid to do this, so appreciation is, appreciated. You can not give yourself one

Here are some simple rules/questions for giving a star. Did the person who posted a solution, or clarified some concept truly help? Did it make a difference? Are you happy/grateful/more knowledgeable? Give a star.

Was the person patient, polite, AND gave a useful answer? Give a star.

Was the information so helpful, that you want to pass it on to others? Definitely give a star. Posts with stars do get attention.

Some post DONÆTs

Do not use Caps Lock. FULL CAPS IS THE EQUIVALENT OF SHOUTING. This is bad form, and is frowned upon. Again, look at Process TGML to see some alternative for emphasis. Bold some words, use italics, there are a number of options.

Do not post email addresses. This is a general rule at Tek-Tips, not just this forum. We all get enough email, thank you very much. Spammers troll forums like this, so in order to prevent that, posting emails is not allowed. If you do, you will likely get a direct warning from site administration to not do so. This does cause issues when you want to be able to send a file to someone trying to help. However, please respect this rule, as it is all our benefit.

Do not cross post. This means posting the same question in more than one forum. If your problem has multiple factors, it is possible to make multiple posts (but in the same forum) and cross reference the threads. Simply copy the thread number of one and paste in the other û with a mention that the other thread is related.

REPRISE: Is this forum for beginners? Again û yes it is, and for the super advanced as well. You will learn a lot from reading posts above your level. All the best with your efforts to use VBA, and remember, that there are no dumb questions.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top