This simple program adds menu items or subitems at runtime without any api calls.
Put a label on the form, in the menu editor add a menu item call it FileMenu with an index of 0, then add a subitem call it FileMenu1 with an index of 0
To add new menus add them as FileMenu(**)
To add subitems add them as FileMenu1(**)
Change the names to suit
Private Sub FileMenu1_Click(Index As Integer)
Select Case Index
Case Index
Label1.Caption = Index
End Select
End Sub
Private Sub Form_Load()
Dim x As Integer
For x = 1 To 4
Load FileMenu1(x)
FileMenu1(x).Caption = "Menu " & x + 1
FileMenu1(x).Visible = True
Next x
End Sub