Beckhoff · TwinCAT 2 Automation Interface
One or both of the specified tree items are not valid for the attempted operation (0x98510002). For LinkVariables() or UnlinkVariables(), this means one or both tree items are not of a variable type, preventing linkage operations.
Click steps to track your progress.
Verify that bstrV1 and bstrV2 arguments refer specifically to variables, not other TwinCAT configuration items.
Check the ItemType property of the identified tree items to ensure they are recognized as a variable type.
Adjust the automation script to target correct variable paths for linking or unlinking.