Options
Option Explicit
You must explicitly define each variable that you use.
Option Private Module
You can force all procedures in a module to be private - even those declared with the Public keyword.
You can omit the Private keyword from your Sub declarations.
Option Base [01]
The lower bound of an array, created using the Array function, is determined by Option Base statement at the top of the module. The default lower bound is 0
Declaring Variables
Dim
聽鍙橀噺聽
As
聽
String
鍙橀噺聽
=
聽
"
initialization
"
Const
聽甯擱噺聽
As
聽
String
聽
=
聽
"
initialization
"
Dim
聽瀹氶暱瀛楃涓猜?/span>
As
聽
String
聽
*
聽
10
瀹氶暱瀛楃涓猜?/span>
=
聽
"
瓚呰繃ten涓棤鏁堬紙涓枃鑻辨枃閮界畻1涓紝鐪嬫潵緙栫爜鐢ㄧ殑unicode錛?/span>
"
Executing Sub from another Procedure
Option
聽
Explicit
Sub
聽executingWay()
聽聽聽 add聽
"
flame
"
,聽
1
,聽
2
聽聽聽 Call
聽add(
"
call
"
,聽
1
,聽
2
)
聽聽聽 Dim
聽subName聽
As
聽
String
:聽subName聽
=
聽
"
add
"
聽聽聽 Run聽subName,聽
"
run
"
,聽
1
,聽
2
End聽Sub
Sub
聽add(exeBy聽
As
聽
String
,聽x聽
As
聽
Integer
,聽y聽
As
聽
Integer
)
聽聽聽 MsgBox
聽exeBy聽
&
聽
"
:聽
"
聽
&
聽(x聽
+
聽y)
End聽Sub
Executing Function from another Procedure
Option
聽
Explicit
Function
聽executingWay()
聽聽聽 Debug.Print聽add(
"
flame
"
,聽
1
,聽
2
)
聽聽聽 Dim
聽funcName聽聽聽
As
聽
String
:聽funcName聽
=
聽
"
add
"
聽聽聽 Debug.Print聽Run(funcName,聽
"
run
"
,聽
1
,聽
2
)
End聽Function
Function
聽add(exeBy聽
As
聽
String
,聽x聽
As
聽
Integer
,聽y聽
As
聽
Integer
)聽
As
聽
String
聽聽聽 add聽
=
聽exeBy聽
&
聽
"
:聽
"
聽
&
聽(x聽
+
聽y)
End聽Function

]]>