Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Macros not showing up in the run macro menu

Tags:

ms-word

excel

vba

I started learning VBA and I don't understand why some macros copy-pasted from the internet do not show up in the run macro menu (Alt-F8).

Below there are 2 macros, but only the second one is showing. Why? And how do I fix it?

Sub Test1(ByVal Target As Hyperlink)

    '...

End Sub

Sub Test2()

    '...

End Sub

enter image description here enter image description here

like image 664
james Avatar asked Jan 30 '23 17:01

james


2 Answers

Macros with arguments are not available in Macros list because they cannot be run alone instead they are called by another macro by passing the required arguments.

like image 77
Subodh Tiwari sktneer Avatar answered Feb 01 '23 07:02

Subodh Tiwari sktneer


If a Sub declaration contains parameters it will not show there.

like image 42
avb Avatar answered Feb 01 '23 05:02

avb