VBA Pass arguments with .onAction
问题 this is how my sub looks like: Sub InsertRowWithContent(rowNo As Long) This is my .onAction: .OnAction = "'InsertRowWithContent""" & C & """'" C is a Long variable declared earlier. It says macro not found. It worked fine before adding an argument! 回答1: I have sucessfully passed arguments with this syntax: .OnAction = "=InsertRowWithContent(" & C & ")" Considerations: C is a long. So don't add quotas, just as you wouldn't if you would call the Sub in the code. OnAction evaluates an expression