VBA & Macro Problems

How to Call a VBA Subroutine with ByRef Arguments Correctly in WPS Office

Elise WilliamsElise Williams Nov 13, 2026 869 views

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.

How to Call a VBA Subroutine with ByRef Arguments Correctly in WPS Office
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.
Before you start

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.

Solution 1Recommended

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.

1
Open the VBA editor

In WPS Spreadsheets, click the Developer tab and select View Code, or press Alt+F11 to open the VBA editor.

2
Locate the calling procedure

In the Project Explorer, double-click the module that contains the calling Sub and click inside the procedure where the call should be made.

3
Write the Call statement with one pair of parentheses

Type Call AccountDesc1(Accountnumber, Accountinfo) so all arguments are enclosed in a single pair of parentheses.

4
Run or debug the macro

Click Run > Run Sub/UserForm or press F5 to test that AccountDesc1 returns the updated Accountinfo value without a syntax error.

Call the Subroutine with the Call Keyword
ByRef variables remain by reference: Pass the variable without extra parentheses. Writing Call AccountDesc1((Accountnumber), Accountinfo) can force Accountnumber to be passed by value.

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. 1. Open WPS Spreadsheets: Launch WPS Office and open the workbook that contains the VBA procedures.
  2. 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. 3. Open the VBA editor: Click Developer > View Code or press Alt+F11.
  4. 4. Write the correct call statement: In the module, use Call AccountDesc1(Accountnumber, Accountinfo) or AccountDesc1 Accountnumber, Accountinfo.
  5. 5. Run and test: Click Run > Run Sub/UserForm or press F5 to confirm ByRef values update correctly.
Preserves ByRef and ByVal VBA macro behavior while editing or running macros.Opens and saves Excel macro-enabled workbooks such as .xlsm for format compatibility.Free and lightweight Office suite with a familiar ribbon, Developer tab, and VBA editor.No Microsoft 365 subscription required to test VBA subroutine calls.
microsoft office alternative - wps office

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.