none
How to use VBA to run a procedure on an add-in ribbon created with VSTO RRS feed

  • Question

  • It was suggested to me by a user on the VBA Express forum to ask my question here as the solution likely involves both VBA and VSTO knowledge. Here is the question:

    ----------------------------------------------------------------------------------

    How can I execute code that is associated with a button that appears on a custom COM add-in  ribbon that was created using Visual Studio Tools for Office (VSTO)? I understand that VBA can execute VSTO code directly if the VSTO code has been appropriately written (i.e. exposed to VBA). The custom add-in ribbon was created by a software vendor for an audit workpaper managment software package that we use and they are not able/willing to help us on this.  We use Word 2007 and the button on the custom ribbon is named "Replace Tokens".

    I believe that there are three files associated with the custom add-in ribbon that contains the "Replace Tokens" button. I can read the text within the first two files using a text editor (see below) but not of the third DLL file. The first two files do not seem to contain any code specific to the "Replace Tokens" button so I figure that it is all inside the DLL file. Is there a way to examine the DLL file and determine if and what VBA command would execute the code associated with the "Replace Tokens" button?

    --------------------------------------------------------------------------------------------------

    AutoAuditWordAddIn.vsto

    <?xml version="1.0" encoding="utf-8"?>
    <asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xrml="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <assemblyIdentity name="AutoAuditWordAddIn.vsto" version="1.0.0.10" publicKeyToken="ab31981d36d32931" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" />
    <description asmv2:publisher="AutoAuditWordAddIn" asmv2:product="AutoAuditWordAddIn" xmlns="urn:schemas-microsoft-com:asm.v1" />
    <deployment install="false" />
    <dependency>
    <dependentAssembly dependencyType="install" codebase="AutoAuditWordAddIn.dll.manifest" size="19799">
    <assemblyIdentity name="AutoAuditWordAddIn.dll" version="1.0.0.10" publicKeyToken="ab31981d36d32931" language="neutral" processorArchitecture="msil" type="win32" />
    <hash>
    <dsig:Transforms>
    <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
    </dsig:Transforms>
    <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
    <dsig:DigestValue>B6wR7LVe5uhCTvX43uh953iv5aQ=</dsig:DigestValue>
    </hash>
    </dependentAssembly>
    </dependency>
    <publisherIdentity name="CN=TLR\u0115070" issuerKeyHash="897dad03a972e68ba9def09cdff09bb90aeb159b" /><Signature Id="StrongNameSignature" xmlns="http://schemas.microsoft.com/windows/rel/2005/reldata"><r:license xmlns:r="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:as="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue>j4ZtK2qjvAtBs4xlgmOzJoJBhJ4=</DigestValue></Reference></SignedInfo><SignatureValue>Nh9Lhhwzh7ArZGxnAVd30w6PVwqtGZ6ejqCOn1O+mVAUxRn8fM2NGwDo6D1CuEOyKKrUfiRDuj2Ms7Ig71hqkKfLphwM7HuhMwkTqXNvCM3nriKQgp8h+uAQ5f0S2pmTk4Uevo/5djMypglG+jBaSm5QPzBdsy5Hnh9kpIY790c=</SignatureValue><KeyInfo><KeyValue><RSAKeyValue><Modulus>0CNBMyBSbYhUAOAks1ixllhnzMixauHy+O5hT0QWEi88OHND4V4QD5w0ll+CCFqO6HzbJPSShG/7Ak4H2N1kT0pP9fjKmgDDFZQHgOfNkuu4AwjyGArTX5ae/4Hr/bsjPR9DMucV/QkUo1SNHD3KXA/iVbblEUPjXJWPT4X9Dg0=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue><X509Data><X509Certificate>MIIByTCCATKgAwIBAgIQNI25da68l6tCBwhhZByxbzANBgkqhkiG9w0BAQUFADAjMSEwHwYDVQQDHhgAVABMAFIAXAB1ADAAMQAxADUAMAA3ADAwHhcNMTIwNjA2MTk0NTM0WhcNMTMwNjA3MDE0NTM0WjAjMSEwHwYDVQQDHhgAVABMAFIAXAB1ADAAMQAxADUAMAA3ADAwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANAjQTMgUm2IVADgJLNYsZZYZ8zIsWrh8vjuYU9EFhIvPDhzQ+FeEA+cNJZfgghajuh82yT0koRv+wJOB9jdZE9KT/X4ypoAwxWUB4DnzZLruAMI8hgK01+Wnv+B6/27Iz0fQzLnFf0JFKNUjRw9ylwP4lW25RFD41yVj0+F/Q4NAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAHPDJpq0SZi5JjAcZrkn9E+d/QPuljJFtPeZdm32TY+YSSGwcKV4WBNkfHqWhMZuOt0piRKeTDtaI35J450tXLQAW79A2IrTFTee4K5n1KWyqiBLSnWBqLt0MWImJ6EBUoknqQZE/bje3qdwY3dPKYdCyvZCax/4pda6aslAnuI4=</X509Certificate></X509Data></KeyInfo></Signature></r:issuer></r:license></msrel:RelData></KeyInfo></Signature></asmv1:assembly>

    - AutoAuditWordAddIn.dll.manifest

    <?xml version="1.0" encoding="utf-8"?>
    <asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1">
    <asmv1:assemblyIdentity name="AutoAuditWordAddIn.dll" version="1.0.0.10" publicKeyToken="ab31981d36d32931" language="neutral" processorArchitecture="msil" type="win32" />
    <description xmlns="urn:schemas-microsoft-com:asm.v1">AutoAuditWordAddIn</description>
    <application />
    <entryPoint>
    <co.v1:customHostSpecified />
    </entryPoint>
    <trustInfo>
    <security>
    <applicationRequestMinimum>
    <PermissionSet Unrestricted="true" ID="Custom" SameSite="site" />
    <defaultAssemblyRequest permissionSetReference="Custom" />
    </applicationRequestMinimum>
    <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
    <!--
    UAC Manifest Options
    If you want to change the Windows User Account Control level replace the 
    requestedExecutionLevel node with one of the following.
    <requestedExecutionLevel level="asInvoker" uiAccess="false" />
    <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
    <requestedExecutionLevel level="highestAvailable" uiAccess="false" />
    If you want to utilize File and Registry Virtualization for backward 
    compatibility then delete the requestedExecutionLevel node.
    -->
    <requestedExecutionLevel level="asInvoker" uiAccess="false" />
    </requestedPrivileges>
    </security>
    </trustInfo>
    <dependency>
    <dependentOS>
    <osVersionInfo>
    <os majorVersion="5" minorVersion="1" buildNumber="2600" servicePackMajor="0" />
    </osVersionInfo>
    </dependentOS>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
    <assemblyIdentity name="Microsoft.Windows.CommonLanguageRuntime" version="2.0.50727.0" />
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
    <assemblyIdentity name="Microsoft.Office.Interop.SmartTag" version="12.0.0.0" publicKeyToken="71E9BCE111E9429C" language="neutral" />
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
    <assemblyIdentity name="Microsoft.Office.Tools.Common.v9.0" version="9.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" processorArchitecture="msil" />
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
    <assemblyIdentity name="Microsoft.Office.Tools.v9.0" version="9.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" processorArchitecture="msil" />
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
    <assemblyIdentity name="Microsoft.Office.Tools.Word.v9.0" version="9.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" processorArchitecture="msil" />
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
    <assemblyIdentity name="Microsoft.VisualStudio.Tools.Applications.Hosting.v9.0" version="9.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" processorArchitecture="msil" />
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
    <assemblyIdentity name="Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0" version="9.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" processorArchitecture="msil" />
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
    <assemblyIdentity name="Microsoft.VisualStudio.Tools.Applications.ServerDocument.v9.0" version="9.0.0.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" processorArchitecture="msil" />
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
    <assemblyIdentity name="stdole" version="7.0.3300.0" publicKeyToken="B03F5F7F11D50A3A" language="neutral" />
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
    <assemblyIdentity name="System.Core" version="3.5.0.0" publicKeyToken="b77a5c561934e089" language="neutral" processorArchitecture="msil" />
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
    <assemblyIdentity name="WindowsBase" version="3.0.0.0" publicKeyToken="31bf3856ad364e35" language="neutral" processorArchitecture="msil" />
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="AutoAuditWordAddIn.dll" size="90624">
    <assemblyIdentity name="AutoAuditWordAddIn" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
    <hash>
    <dsig:Transforms>
    <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
    </dsig:Transforms>
    <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
    <dsig:DigestValue>u/CJDxXMfeIz1KDT5Yg0HJ7AJ9g=</dsig:DigestValue>
    </hash>
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="AxInterop.MSMAPI.dll" size="15872">
    <assemblyIdentity name="AxInterop.MSMAPI" version="1.1.0.0" language="neutral" processorArchitecture="msil" />
    <hash>
    <dsig:Transforms>
    <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
    </dsig:Transforms>
    <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
    <dsig:DigestValue>NtOgkFcP+mIFSh1o1SnXVKNFiF8=</dsig:DigestValue>
    </hash>
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Interop.Scripting.dll" size="32768">
    <assemblyIdentity name="Interop.Scripting" version="1.0.0.0" language="neutral" processorArchitecture="x86" />
    <hash>
    <dsig:Transforms>
    <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
    </dsig:Transforms>
    <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
    <dsig:DigestValue>5IagQ40hn55cjsKOC0wsFHQJ8ks=</dsig:DigestValue>
    </hash>
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Microsoft.Office.Interop.Word.dll" size="907120">
    <assemblyIdentity name="Microsoft.Office.Interop.Word" version="14.0.0.0" publicKeyToken="71E9BCE111E9429C" language="neutral" processorArchitecture="msil" />
    <hash>
    <dsig:Transforms>
    <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
    </dsig:Transforms>
    <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
    <dsig:DigestValue>mRSB1k8bC7UAwoGX+xBD2vqT7GQ=</dsig:DigestValue>
    </hash>
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Microsoft.Vbe.Interop.dll" size="63336">
    <assemblyIdentity name="Microsoft.Vbe.Interop" version="14.0.0.0" publicKeyToken="71E9BCE111E9429C" language="neutral" processorArchitecture="msil" />
    <hash>
    <dsig:Transforms>
    <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
    </dsig:Transforms>
    <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
    <dsig:DigestValue>H4lHETldL8Rv/mYBu/HRDyZwUxU=</dsig:DigestValue>
    </hash>
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Office.dll" size="448360">
    <assemblyIdentity name="office" version="14.0.0.0" publicKeyToken="71E9BCE111E9429C" language="neutral" processorArchitecture="msil" />
    <hash>
    <dsig:Transforms>
    <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
    </dsig:Transforms>
    <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
    <dsig:DigestValue>I5WeW6esLo/jOaGQySB65kkcy+k=</dsig:DigestValue>
    </hash>
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Paisley.AAwin.BLL.dll" size="206336">
    <assemblyIdentity name="Paisley.AAwin.BLL" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
    <hash>
    <dsig:Transforms>
    <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
    </dsig:Transforms>
    <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
    <dsig:DigestValue>z28SBG4WbPtXBMx9gkmv0uwWX90=</dsig:DigestValue>
    </hash>
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Paisley.AAWin.BO.dll" size="112640">
    <assemblyIdentity name="Paisley.AAWin.BO" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
    <hash>
    <dsig:Transforms>
    <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
    </dsig:Transforms>
    <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
    <dsig:DigestValue>WDrBrTduqyfbcncFjh4gXd1n9fY=</dsig:DigestValue>
    </hash>
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Paisley.AAWin.Data.dll" size="117248">
    <assemblyIdentity name="Paisley.AAWin.Data" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
    <hash>
    <dsig:Transforms>
    <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
    </dsig:Transforms>
    <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
    <dsig:DigestValue>h5lH0J/5ZJX71jjyK9Om4ZLH3Kg=</dsig:DigestValue>
    </hash>
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Paisley.AAWin.UIO.dll" size="46592">
    <assemblyIdentity name="Paisley.AAWin.UIO" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
    <hash>
    <dsig:Transforms>
    <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
    </dsig:Transforms>
    <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
    <dsig:DigestValue>1ofdG/1VkrYI47MU4y9OJ9TnpVM=</dsig:DigestValue>
    </hash>
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Paisley.AAWin.Util.dll" size="87552">
    <assemblyIdentity name="Paisley.AAWin.Util" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
    <hash>
    <dsig:Transforms>
    <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
    </dsig:Transforms>
    <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
    <dsig:DigestValue>+G2Et1dsEEUxgb1MJnWKDUXmG6Y=</dsig:DigestValue>
    </hash>
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Xceed.Compression.dll" size="94832">
    <assemblyIdentity name="Xceed.Compression" version="2.0.105.0" publicKeyToken="BA83FF368B7563C6" language="neutral" />
    <hash>
    <dsig:Transforms>
    <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
    </dsig:Transforms>
    <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
    <dsig:DigestValue>s5WoiIag/fSxWYr1Ng0xnG4uM6c=</dsig:DigestValue>
    </hash>
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Xceed.Compression.Formats.dll" size="57984">
    <assemblyIdentity name="Xceed.Compression.Formats" version="1.0.105.0" publicKeyToken="BA83FF368B7563C6" language="neutral" />
    <hash>
    <dsig:Transforms>
    <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
    </dsig:Transforms>
    <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
    <dsig:DigestValue>QDZV5Z/2lNPgH6+3bgx/qEyE3Tg=</dsig:DigestValue>
    </hash>
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Xceed.FileSystem.dll" size="107120">
    <assemblyIdentity name="Xceed.FileSystem" version="2.0.105.0" publicKeyToken="BA83FF368B7563C6" language="neutral" />
    <hash>
    <dsig:Transforms>
    <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
    </dsig:Transforms>
    <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
    <dsig:DigestValue>7z5flh6bgnlpgxd5o8khOzvi7v0=</dsig:DigestValue>
    </hash>
    </dependentAssembly>
    </dependency>
    <dependency>
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Xceed.Zip.dll" size="176736">
    <assemblyIdentity name="Xceed.Zip" version="2.0.105.0" publicKeyToken="BA83FF368B7563C6" language="neutral" />
    <hash>
    <dsig:Transforms>
    <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
    </dsig:Transforms>
    <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
    <dsig:DigestValue>izk7uhM5o/CPqNy9EFZzeC5hDaA=</dsig:DigestValue>
    </hash>
    </dependentAssembly>
    </dependency>
    <vstav3:addIn xmlns:vstav3="urn:schemas-microsoft-com:vsta.v3">
    <vstav3:entryPointsCollection>
    <vstav3:entryPoints>
    <vstav3:entryPoint class="AutoAuditWordAddIn.ThisAddIn">
    <assemblyIdentity name="AutoAuditWordAddIn" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
    </vstav3:entryPoint>
    </vstav3:entryPoints>
    </vstav3:entryPointsCollection>
    <vstav3:update enabled="true">
    <vstav3:expiration maximumAge="7" unit="days" />
    </vstav3:update>
    <vstav3:application>
    <vstov4:customizations xmlns:vstov4="urn:schemas-microsoft-com:vsto.v4">
    <vstov4:customization>
    <vstov4:appAddIn application="Word" loadBehavior="3" keyName="AutoAuditWordAddIn">
    <vstov4:friendlyName>AutoAuditWordAddIn</vstov4:friendlyName>
    <vstov4:description>AutoAuditWordAddIn</vstov4:description>
    </vstov4:appAddIn>
    </vstov4:customization>
    </vstov4:customizations>
    </vstav3:application>
    </vstav3:addIn>
    <publisherIdentity name="CN=TLR\u0115070" issuerKeyHash="897dad03a972e68ba9def09cdff09bb90aeb159b" /><Signature Id="StrongNameSignature" xmlns="http://schemas.microsoft.com/windows/rel/2005/reldata"><r:license xmlns:r="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:as="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue>nh1jQX+x4Y1pDHgY37KKp8C0UWo=</DigestValue></Reference></SignedInfo><SignatureValue>ZN3TqcucYSzMghrhJ6iuXIMiDHBXNwDSP24wN8V46Dyh5ZtsyfPm59HRXoz6huTLscueJTN3SXuIRQRgaYX6QrPyGua1dKpBES1lgJ+Jgt66iuc5lUW5aB893EWYWjzRuqoi2lx+JK6QNiYeMmq2z/9/O/y8F+TDXNTu7Axdu+k=</SignatureValue><KeyInfo><KeyValue><RSAKeyValue><Modulus>0CNBMyBSbYhUAOAks1ixllhnzMixauHy+O5hT0QWEi88OHND4V4QD5w0ll+CCFqO6HzbJPSShG/7Ak4H2N1kT0pP9fjKmgDDFZQHgOfNkuu4AwjyGArTX5ae/4Hr/bsjPR9DMucV/QkUo1SNHD3KXA/iVbblEUPjXJWPT4X9Dg0=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue><X509Data><X509Certificate>MIIByTCCATKgAwIBAgIQNI25da68l6tCBwhhZByxbzANBgkqhkiG9w0BAQUFADAjMSEwHwYDVQQDHhgAVABMAFIAXAB1ADAAMQAxADUAMAA3ADAwHhcNMTIwNjA2MTk0NTM0WhcNMTMwNjA3MDE0NTM0WjAjMSEwHwYDVQQDHhgAVABMAFIAXAB1ADAAMQAxADUAMAA3ADAwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANAjQTMgUm2IVADgJLNYsZZYZ8zIsWrh8vjuYU9EFhIvPDhzQ+FeEA+cNJZfgghajuh82yT0koRv+wJOB9jdZE9KT/X4ypoAwxWUB4DnzZLruAMI8hgK01+Wnv+B6/27Iz0fQzLnFf0JFKNUjRw9ylwP4lW25RFD41yVj0+F/Q4NAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAHPDJpq0SZi5JjAcZrkn9E+d/QPuljJFtPeZdm32TY+YSSGwcKV4WBNkfHqWhMZuOt0piRKeTDtaI35J450tXLQAW79A2IrTFTee4K5n1KWyqiBLSnWBqLt0MWImJ6EBUoknqQZE/bje3qdwY3dPKYdCyvZCax/4pda6aslAnuI4=</X509Certificate></X509Data></KeyInfo></Signature></r:issuer></r:license></msrel:RelData></KeyInfo></Signature></asmv1:assembly>
    --------------------------------------------------------------------------------
    Last edited by hkeiner : 12-14-2012 at 12:12 PM.  
    Local Time: 10:04 AM
    Local Date: 12-18-2012
    Location:   
        





    • Edited by hkeiner Tuesday, December 18, 2012 7:09 PM
    Tuesday, December 18, 2012 6:42 PM

Answers

  • Sub SimulateClickOnReplaceTokensButton() SendKeys "%", True SendKeys "(Y)", True SendKeys "(Y)", True SendKeys "(0)", True End Sub

    Cindy,

    I found that Method 2 (which invoved learning how to use the Ribbon Accessibiltiy APIs) was a bit difficult and complicated for me to quickly figure out (if at all).  Instead, I found Method 1 much simpler and it works OK. The above VBA code does the basic stuff to mimic using the keyboard to click on the Replace Tokens button. Of course, I will be using some additional code to accomplish what I want to do with this button, but Method 1 was the best solution for me!  

    Thanks so much for your help








    • Marked as answer by hkeiner Thursday, December 20, 2012 6:35 PM
    • Edited by hkeiner Thursday, December 20, 2012 10:35 PM
    Thursday, December 20, 2012 6:24 PM

All replies

  • to expose add-in object to com world (which also counts VBA) few explicit steps has to be taken, which means that if they did not do it for their own features it is almost 100% not there. And i think ExecuteMso (http://msdn.microsoft.com/en-us/library/office/aa434602(v=office.12).aspx) works only for builtin ribbon buttons so i guess you are out of luck unless you use reflector or some other decompiler and take a look if there is a method that you can safely invoke (which usually means method without parameters, because otherwise you will have a lot of trouble creating doubles for office params)
    Tuesday, December 18, 2012 8:41 PM
  • to expose add-in object to com world (which also counts VBA) few explicit steps has to be taken, which means that if they did not do it for their own features it is almost 100% not there.

    To clarify, the add-in type for the custom ribbon is shown as a "COM add-in" in Word Options/Add-Ins view.  Would this this mean that the 'few explicit steps"  to expose the object to "com world" have certainly been  taken or do I stillI need to take a closer look at the DLL file itself to determine this?  If I have to take a closer look at the DLL file, I have PEBrowsePro that seems to allow me to decompile and look at the contents of the DLL file.  I just need to know what to look for in the DLL file.

    Thanks for your interest in my situation. I appreciate your expertise on this.  If I can determine with certainty that I can not call the "Replace Tokens" code on the custom ribbon using VBA code without editing the DLL, that is very usefull information too because I can then stop trying to figure this out needlessly.








    • Edited by hkeiner Tuesday, December 18, 2012 11:41 PM
    Tuesday, December 18, 2012 10:17 PM
  • no, COM add-in tabs does not count, open main add-in dll in .net decompiler and see if they overrite RequestComAddinAutomationService method as described here http://msdn.microsoft.com/en-us/library/bb608614
    Wednesday, December 19, 2012 5:20 PM
  • Hi hkeiner

    If the user presses ALT in the Office application interface a letter or number, or combination of letter(s) and number(s) appears next to each Ribbon control. In this way, the user can access commands via the keyboard.

    So, theoretically, your code can use SendKeys to execute any control.

    Practically, the keyboard shortcuts aren't stable if there are conflicting shortcut assignments or if additional controls are added.

    However...

    The Ribbion exposes an Accessibility API that can probably be used to send a "keypress" to a specific control in a more reliable manner. The documentation can be found on MSDN: http://msdn.microsoft.com/en-us/library/bb404170.aspx


    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, December 19, 2012 7:13 PM
    Moderator
  • no, COM add-in tabs does not count, open main add-in dll in .net decompiler and see if they overrite RequestComAddinAutomationService method as described here

    Damian,

    Perhaps I am over my head on this but I did decompile AutoAuditWordAddIn.dll using Telerik JustDecompile applicaton.  I searched for the text "RequestComAddinAutomationService" and did not find it. I guess I can conclude from this that the DLL does not contain any code that overrides the RequestComAddinAutomationService method and that I will not be able to call the "ReplaceTokens" code using VBA.

    After decompiling the DLL I was able to determine the exact name for the code associated with the Replace Tokens button and so I also tried to call the code using VBA just to see if it would work. I got the following error message "Run Time Error 424 - Object Required" and so unless I am calling the ReplaceTokens code incorrectly, this probably also confirms that the VBA can not call this code in the DLL. I tried the following two commands:

    Call ReplaceTokens

    Call AutoAuditWordAddIn.ReplaceTokens

     

     

     

    This is the code in the DLL related to the Replace Tokens button on the custom add-in ribbon:

    Public Shared Sub ReplaceTokens()
        Dim enumerator As IEnumerator = Nothing
        Dim tokens As TokenList = TokenManager.GetTokens(Standard.Glob_Attachment.get_AuditID())
        Using TryCast(enumerator, IDisposable)
            If (Not TypeOf enumerator Is IDisposable) Then
                enumerator = Globals.ThisAddIn.Application.get_ActiveDocument().get_StoryRanges().GetEnumerator()
                While enumerator.MoveNext()
                    Dim count As Integer = tokens.Count - 1
                    Dim i As Integer = 0
                    Do
                        WordUtils.ReplaceInRange(DirectCast(enumerator.Current, Range), tokens(i).PlaceHolder, tokens(i).Value)
                        i = i + 1
                    Loop While i <= count
                End While
            End If
        End Using
    End Sub









    • Edited by hkeiner Wednesday, December 19, 2012 10:10 PM
    Wednesday, December 19, 2012 9:52 PM
  • METHOD 1

    If the user presses ALT in the Office application interface a letter or number, or combination of letter(s) and number(s) appears next to each Ribbon control. In this way, the user can access commands via the keyboard ...So, theoretically, your code can use SendKeys to execute any control.

    METHOD 2

    However...The Ribbion exposes an Accessibility API that can probably be used to send a "keypress" to a specific control in a more reliable manner. The documentation can be found on MSDN:

    Cindy,

    DamianD's excellent advice and guidance has helped me conclude that I am likely not going to be able to call the Replace Tokens code directly using a VBA call command. The two alternative methods you discuss in your post seem promising . I would like to try Method 2, but I had a bit of trouble fully understanding how to do that after looking through the link you provided for the Accessability API stuff. I am not one to ask for hand-holding when I can figure things out on my own, but it is not clear to me if the Accessability API stuff applies to only the standard Ribbon or to also custom ribbons, such as the one I am concerned with. If you can confirm that Method 2 applies to custom ribbons too, that would be great and I will re-read the linked pages in greater detail. If Method 2 does not apply to my situation, then I do not need to re-read the linked pages and will begin work on implementing Method 1 instead. By the way, I would like to mention that the custom add-in ribbon is very rarely changed by the vendor in case that makes Method 1 more feasible.

    Thanks

    THIS IS HOW THE CUSTOM RIBBON RESPONDS TO KEY PRESSES ON THE KEYBOARD

    After pressing the ALT key,  Word shows an interface letter of "Y" for the custom add-in ribbon. Pressing the "Y" key on the keyboard after that causes the the Replace Tokens button on the custom add-in ribbon to shown the interface letter/number  of  "Y0" . Then pressing the "Y" and then the "0" keys on the keyboard invokes the Replace Tokens button. This is true for all the PCs in our work group that have this custom add-in ribbon installed.


















    • Edited by hkeiner Thursday, December 20, 2012 10:38 PM
    Thursday, December 20, 2012 12:25 AM
  • Hi hkeiner

    As far as I know, the Ribbon Accessibiltiy APIs should work for all controls that are integrated into a Ribbon that's loaded by the Office application. Any documentation you find on MSDN is going to refer only to the built-in controls, but the principle should be the same for custom controls, as well.

    I have never actually used this, myself, however, so I can't speak from personal experience or give you much in the way of assistance. I do have a number of additional links. The first two deal more with "clicking" a Ribbon tab (to make it display "by default"). I don't remember what the topic of the third link was, specifically.


    The fact that you get "Y" as a keytip prefixes indicates that the software manufacturer did not define any keytip for the Ribbon controls. The "Y" will likely remain stable as long as no other addins are installed that also have no keytip defined for their Ribbon tab (or used "Y"). The designations within the Ribbon tab should remain stable as long as you don't upgrade to a newer version where something has changed.


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, December 20, 2012 7:17 AM
    Moderator
  • Sub SimulateClickOnReplaceTokensButton() SendKeys "%", True SendKeys "(Y)", True SendKeys "(Y)", True SendKeys "(0)", True End Sub

    Cindy,

    I found that Method 2 (which invoved learning how to use the Ribbon Accessibiltiy APIs) was a bit difficult and complicated for me to quickly figure out (if at all).  Instead, I found Method 1 much simpler and it works OK. The above VBA code does the basic stuff to mimic using the keyboard to click on the Replace Tokens button. Of course, I will be using some additional code to accomplish what I want to do with this button, but Method 1 was the best solution for me!  

    Thanks so much for your help








    • Marked as answer by hkeiner Thursday, December 20, 2012 6:35 PM
    • Edited by hkeiner Thursday, December 20, 2012 10:35 PM
    Thursday, December 20, 2012 6:24 PM