|
|
What does an ampersand mean in VBA? |
|
Author |
Message |
SimonH
|
Posted: Thu Nov 20 13:39:14 CST 2003 |
Top |
Excel Programming >> What does an ampersand mean in VBA?
I know that an ampersand is generally used as the concatenation operator but
I seemed to have found another usage of it that I don't understand. Here is
a code snippet:
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
Set OraDatabase = OraSession.OpenDatabase("2:", "scott/tiger", 0&)
Set EmpDynaset = OraDatabase.DbCreateDynaset("select * from emp", 0&)
Notice the parameters 0&, what does the & do? Based on the documentation I
would have just put a zero instead of a 0&.
-J
Excel285
|
|
|
|
|
Chip
|
Posted: Thu Nov 20 13:39:14 CST 2003 |
Top |
Excel Programming >> What does an ampersand mean in VBA?
In this context, the & character makes the number a Long type value, rather
than an Integer.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
> I know that an ampersand is generally used as the concatenation operator
but
> I seemed to have found another usage of it that I don't understand. Here
is
> a code snippet:
>
> Set OraSession = CreateObject("OracleInProcServer.XOraSession")
> Set OraDatabase = OraSession.OpenDatabase("2:", "scott/tiger", 0&)
> Set EmpDynaset = OraDatabase.DbCreateDynaset("select * from emp", 0&)
>
> Notice the parameters 0&, what does the & do? Based on the documentation I
> would have just put a zero instead of a 0&.
>
> -J
>
>
|
|
|
|
|
Steve
|
Posted: Thu Nov 20 13:58:32 CST 2003 |
Top |
Excel Programming >> What does an ampersand mean in VBA?
> I know that an ampersand is generally used as the concatenation operator but
> I seemed to have found another usage of it that I don't understand. Here is
> a code snippet:
>
> Set OraSession = CreateObject("OracleInProcServer.XOraSession")
> Set OraDatabase = OraSession.OpenDatabase("2:", "scott/tiger", 0&)
> Set EmpDynaset = OraDatabase.DbCreateDynaset("select * from emp", 0&)
>
> Notice the parameters 0&, what does the & do? Based on the documentation I
> would have just put a zero instead of a 0&.
It forces the 0 to be a long instead of an integer.
This ensures that the correct type of variable is passed as the Oracle
procedure argument.
|
|
|
|
|
|
|