How to Call a VBA Subroutine with ByRef Arguments Correctly in WPS Office
Question details
The user needs to call a VBA subroutine with arguments so ByRef parameters can return updated values while avoiding syntax errors and the missing macro issue.

- Product
- WPS Office Spreadsheets - VBA Editor
- Device & OS
- not provided
- Scenario
- A VBA calling procedure must pass variables to another procedure and receive changed values back through ByRef arguments.
- Observed behavior
- The called subroutine may not appear in the Macro dialog because it has required arguments, and incorrect parentheses can cause a syntax error or force an argument to be passed by value.
Open WPS Spreadsheets, enable the Developer tab if needed, and press Alt+F11 to open the VBA editor. Confirm the called subroutine has declared parameters and is located in an accessible module before editing the calling statement.
Call the Subroutine with the Call Keyword
Use this method when you want explicit Call syntax and need to pass all arguments inside one pair of parentheses without changing ByRef behavior.
The Call statement requires one set of parentheses around the entire argument list. These parentheses do not determine ByVal or ByRef; the called procedure's parameter declaration does.
In WPS Spreadsheets, click the Developer tab and select View Code, or press Alt+F11 to open the VBA editor.
In the Project Explorer, double-click the module that contains the calling Sub and click inside the procedure where the call should be made.
Type Call AccountDesc1(Accountnumber, Accountinfo) so all arguments are enclosed in a single pair of parentheses.
Click Run > Run Sub/UserForm or press F5 to test that AccountDesc1 returns the updated Accountinfo value without a syntax error.

Call the Subroutine Without the Call Keyword
Use this shorter syntax when you want to omit Call and write the subroutine name followed by the argument list without surrounding parentheses.
Declare Parameters Explicitly as ByRef or ByVal
Use this method when you need to control which arguments can be modified and which are read-only inputs in the called subroutine.
Call VBA Subroutines with ByRef Arguments in WPS Office
Use the WPS Office VBA editor to call subroutines with the correct Call syntax or argument-list syntax, so ByRef parameters return updated values without macro dialog or parenthesis errors.
- 1. Open WPS Spreadsheets: Launch WPS Office and open the workbook that contains the VBA procedures.
- 2. Enable the Developer tab if needed: If the Developer tab is not visible, enable it from File > Options > Customize Ribbon and check Developer, then click OK.
- 3. Open the VBA editor: Click Developer > View Code or press Alt+F11.
- 4. Write the correct call statement: In the module, use Call AccountDesc1(Accountnumber, Accountinfo) or AccountDesc1 Accountnumber, Accountinfo.
- 5. Run and test: Click Run > Run Sub/UserForm or press F5 to confirm ByRef values update correctly.

Frequently Asked Questions
Why does my subroutine with arguments not show in the Macro dialog in WPS Office?
The Macro dialog normally lists macros without required arguments. Call the subroutine from another Sub and supply the arguments, for example Call AccountDesc1(Accountnumber, Accountinfo).
Does wrapping an argument in parentheses change ByRef to ByVal in VBA?
Yes, parentheses around a single argument can force that argument to be passed by value. Use AccountDesc1 Accountnumber, Accountinfo or Call AccountDesc1(Accountnumber, Accountinfo) to pass Accountnumber by reference when needed.
When should I use ByVal instead of ByRef in a VBA subroutine?
Use ByVal for values that the called procedure should not modify. Use ByRef when the calling procedure must receive the changed variable back.
Can I call a VBA Sub without the Call keyword in WPS Office?
Yes. Write the subroutine name followed by the arguments separated by commas and no parentheses around the whole argument list: AccountDesc1 Accountnumber, Accountinfo.
Why do I get a syntax error when using Call with multiple arguments?
The Call statement requires exactly one pair of parentheses around all arguments. Check for extra parentheses around individual ByRef variables or missing closing parentheses.




