调用COM在Excel插件通过VBA [英] Call COM add-in via VBA in excel
问题描述
我有一个COM加载项写在VSTO,我想使用VBA宏调用。随着加载我需要启动它,输入一些文字(自动),然后运行该应用程序。该加载项是所有的按钮,和它的一些是加密的,我不能轻易访问code(这是第三方)。遗憾的是点击该插件的时候,录音功能不拿起任何活动,我一直无法将其添加到在VBA引用列表。我试着这样做的几种方法,至今都没有奏效。
感谢您的帮助!
-Nick
由于是,这是我的code。由于写的,它抛出第二至code的最后一行运行时错误91 code。如果我周围添加的最后一行列表括号我得到一个语法错误(预期:=)。我不知道是什么问题?
子测试()
昏暗的插件作为COMAddIn
昏暗automationObject作为对象
昏暗SQL_ code作为字符串
昏暗PW作为字符串
昏暗的名称作为字符串
设置插件= Application.COMAddIns(Orion2010)
SQL_ code =选择的startDateTime,TLI,SERIALNUMBER,键名FROM vmfgoperationdata WHERE SERIALNUMBER在('90102072B030H','90102072003BF')和operationname ='部分扫描')
PW =密码
NAME =NA \\ npiotrowski
设置automationObject = addIn.Object
automationObject.Utility.RefreshData名称,PW,SQL_ code
结束小组
检查这些链接
I have a COM add-in written in VSTO that I want to call using a VBA macro. With the add-in I need to launch it, enter some text (automatically), then run the application. The add-in is all push button, and I can't readily access the code as some of it is encrypted (it is 3rd party). Regrettably the record function doesn't pick up any activity when clicking this add-in, and I've been unable to add it to the references list on the VBA. I've tried several ways of doing this and none have worked so far.
Thank you for your help!
-Nick
As is this is my code. As written, it throws a Run Time Error 91 code on the second to last line of code. If I add parentheses around the last line list I get a syntax error (Expected:=). I'm not sure what the issue is?
Sub Test()
Dim addIn As COMAddIn
Dim automationObject As Object
Dim SQL_CODE As String
Dim PW As String
Dim Name As String
Set addIn = Application.COMAddIns("Orion2010")
SQL_CODE = "SELECT startdatetime, tli, serialnumber, keyname FROM vmfgoperationdata WHERE serialnumber in ( '90102072B030H' , '90102072003BF') and operationname = 'Part Scanning')"
PW = "password"
Name = "na\npiotrowski"
Set automationObject = addIn.Object
automationObject.Utility.RefreshData Name, PW, SQL_CODE
End Sub
Check these links
How to: Expose Code to VBA in a Visual C# Project
Walkthrough: Calling Code from VBA in a Visual C# Project
这篇关于调用COM在Excel插件通过VBA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!