Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

adding new workbooks

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Adding new workbooks

Adding new workbooks

ResolvedVersion 2007

John has attended:
Excel VBA Intro Intermediate course

Adding new workbooks

Good morning!

I was revisiting the course material for VBA Intro and Intermediate, and just wanted clarity on when is the best case to use the If Then or the Select Case process?

For example, if the process only had a few (less than 5) options then would you use the If then function otherwise use the Select Case function? Are either faster running than the other or is the Select Case easier to follow?

Much appreciate your help?

John

RE: Adding new workbooks

Hi John

Thanks for getting in touch, good to hear from you.

As a general guide, I would consider the IF... THEN when I have 3 or fewer options to choose between.

Any more than that, and I would use the SELECT CASE. It is easier to read and arguably write (for humans). I haven't seen any direct research comparing the speed of the methods.

The only possible downside to SELECT CASE is that you have to test the same object in every scenario. Most of the time you will be doing that but it's worth bearing in mind if your IF decision has to branch out and test different objects conditionally.

Kind regards

Gary Fenn
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

Wed 28 Nov 2012: Automatically marked as resolved.

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Access tip:

Hide Access Tables

One method of stopping your Access tables appearing in Database window, is to rename the table(s) with the prefix usys.

This converts the table into a system object, which cannot be viewed in the Database window.

You can show system objects in the Database window by the following:

Step 1: On the Tools menu, click Options.
Step 2: Click the View tab.
Under Show, select the System Objects check box.
Click OK.

View all Access hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.