View Single Post
 
Old 03-08-2022, 12:09 PM
VBAadvocate VBAadvocate is offline Windows 10 Office 2019
Novice
 
Join Date: Feb 2022
Posts: 12
VBAadvocate is on a distinguished road
Default Application.Run with args fails

After adding a template file to the Addins collection and installing the addin I can successfully run subs in the template that do not require any arguments.

However, if the sub requires an argument, it fails with the following error:
"Run-time error '438': Object doesn't support this property or method"

I am using the following line of code:

Application.Run strAddinFilename & "!SubName", strText

Where:
strAddinFileName - filename of the template with extension (not a full path)
SubName - name of a Sub
strText - name variable being passed as an argument to Sub.

I've modified the template sub using byVal and byRef for its arguments and various hacks using parens, the Call keyword and other junky ideas without any success.

According to the "About Word" on the Account page in Microsoft Word, I have:
Version 2112 (Build 14729.20322 Click-to-Run)

Hoping there's help, VBAadvocate
Reply With Quote