Dim Name

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

Hi,

I'm trying to figure it out how to accept using DIM when using "&"

Example:

Dim A&B (it would not accept it)

Dim AB (it's accept)

Is there a way to set like ---- DIM A&B

Your help would be much appreciated...
 
From the Help file:

Use the following rules when you name procedures, constants, variables, and
arguments in a Visual Basic module:

· You must use a letter as the first character.
· You can't use a space, period (.), exclamation mark (!), or the characters
@, &, $, # in the name.
· Name can't exceed 255 characters in length.
· Generally, you shouldn't use any names that are the same as the functions,
statements, and methods in Visual Basic. You end up shadowing the same
keywords in the language. To use an intrinsic language function, statement,
or method that conflicts with an assigned name, you must explicitly identify
it. Precede the intrinsic function, statement, or method name with the name
of the associated type library. For example, if you have a variable called
Left, you can only invoke the Left function using VBA.Left.

· You can't repeat names within the same level of scope. For example, you
can't declare two variables named age within the same procedure. However,
you can declare a private variable named age and a procedure-level variable
named age within the same module.

Note Visual Basic isn't case-sensitive, but it preserves the
capitalization in the statement where the name is declared.
 
Dim A,B As String but it's not recommended.

....not recommended because A will be a Variant :-)

Dim A as String, B As String
....would get you 2 strings on one line, but I'm not sure wether the OP was
actually trying to Dim 2 variables at once or Dim one variable with a "&" in
it (which you can't do because VB doesn't allow that character in variable
names).
 
Back
Top