User FAQs

If you have a question, please send it to us.

1) Is there any official documentation from Microsoft ?
Yes there is and it is very comprehensive.
link -

2) Should I indent my code with spaces or tabs ?
Always use tabs to indent your code to bring structure, never use spaces.
link -

3) Do I really need to add comments ?
Try and put your comments on the same line, on the right hand side of the code.
And only add "value added" comments which explain why, do not add trivial comments.
Make the names of your subroutines, functions and variables self-describing
Always add a Comment Block above every procedure and function.

4) What is Option Explicit and what does it do ?

Option Explicit 

Including this at the top of a module means that all variables must be explicitly declared using the Dim statement.
This statement only affects the module it is declared in.

5) What problems do you have if you don't use Option Explicit ?
Variables do not have to be declared before they are used.
Mistyping a variable name will create a new variable and will probably create a run-time error.

6) What is a Type Declaration Character ?
Also known as a variable declaration character or type declaration suffix.
It is possible to declare variables by appending a special character to the end of the variable name.

Dim iNumber@   'shorthand for As Currency  
Dim iNumber# 'shorthand for As Double
Dim iNumber% 'shorthand for As Integer
Dim iNumber& 'shorthand for As Long
Dim iNumber! 'shorthand for As Single
Dim iNumber^ 'shorthand for As LongLong - 64bit only
Dim iText$ 'shorthand for As String

7) What is a Literal Number Suffix ?
Also known as numeric literal suffixes.
When you use the Variant data type the compiler is able to determine the correct data type for a numerical literal however there might be times when the default data type is different to the desired one.

Dim myNumberV1 As Variant 
Dim myNumberV2 As Variant
myNumberV1 = 100
myNumberV2 = 100#

Debug.Print VBA.TypeName(myNumberV1) 'Integer
Debug.Print VBA.TypeName(myNumberV2) 'Double

8) What is the difference between a Literal Constant and a Symbolic Constant ?
A literal constant is a specific value such as a number, date or text.

Dim myDate As Date 
myDate = #12/31/2020#

A symbolic constant is a literal constant that is represented by a name.

Public Const sVALUE As String = "text" 

9) What is the difference between a Do-While loop and a Do-Until loop ?
In a Do-While loop the condition must be True.

Loop While boolean-expression = True

In a Do-Until loop the condition must be False.

Do Until boolean-expression = False 

© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext