Duuudes:
Have a question for the programmers. I have created a right-click popup menu with vba. On one of the "msoControlButtons" I want the on action procedure to call a function that requires arguments to be passed to it. The onaction procedure requires a string so this confuses me. Let me show an ex:
here's my menu button:
Set MenuItem = InventorPopUp.Controls.Add(msoControlButton)
With MenuItem
.Caption = "mm: (all)"
.OnAction = "Function1"
End With
here's my function:
Public Function Function1(arg1 As String, arg2 As String)
do some stuff
End Function
Now as you can see for the onaction I told it to run "function1" which works great if there are no arguments to pass, but I don't understand how to call the function and pass the arguments. I have tried several formats such as
.onaction = "Function1(string1, string2)"
.onaction = "Function1(""string1"", ""string2"")"
.onaction = "Function1 "string1", "string2""
.onaction = Function1 "string1", "string2"
nothing seems to work. VbA keeps giving me an "Argument not Optional" error. I know i could create as many functions as I need to to cover every possible argument but it would be much easier to pass the arguments. Any help would be greatly appreciated.
Have a question for the programmers. I have created a right-click popup menu with vba. On one of the "msoControlButtons" I want the on action procedure to call a function that requires arguments to be passed to it. The onaction procedure requires a string so this confuses me. Let me show an ex:
here's my menu button:
Set MenuItem = InventorPopUp.Controls.Add(msoControlButton)
With MenuItem
.Caption = "mm: (all)"
.OnAction = "Function1"
End With
here's my function:
Public Function Function1(arg1 As String, arg2 As String)
do some stuff
End Function
Now as you can see for the onaction I told it to run "function1" which works great if there are no arguments to pass, but I don't understand how to call the function and pass the arguments. I have tried several formats such as
.onaction = "Function1(string1, string2)"
.onaction = "Function1(""string1"", ""string2"")"
.onaction = "Function1 "string1", "string2""
.onaction = Function1 "string1", "string2"
nothing seems to work. VbA keeps giving me an "Argument not Optional" error. I know i could create as many functions as I need to to cover every possible argument but it would be much easier to pass the arguments. Any help would be greatly appreciated.