“宏”对话框仅列出不带参数的非专用子例程。
Option Explicit
' this will show
Public Sub Public_Example()
Debug.Print "Hello Public " ' print on immediate window
End Sub
' and this will show
Sub Public_Example()
Debug.Print "Hello Public " ' print on immediate window
End Sub
如果您声明子例程Private,则返回任何值或
不是
带有参数的子例程将不会显示在“宏”对话框中
示例
Option Explicit
' this will not show
Public Sub Public_Example(Miserable As Integer)
Debug.Print "Hello Private " ' print on immediate window
End Sub
' this will not show
Private Sub Private_Example()
Debug.Print "Hello Private " ' print on immediate window
End Sub
' this will not show
Public Function Public_Example()
Debug.Print "Hello Private " ' print on immediate window
End Function
' this will not show
Private Function Private_Example()
Debug.Print "Hello Private " ' print on immediate window
End Function