执行代码时收到类型错误 [英] I receive a Type Error whencode is executed

查看:102
本文介绍了执行代码时收到类型错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好



当我的VA应用程序执行以下行时,我收到类型不匹配错误。



Hello

I receive a Type Mismatch Error when my VA application executes the following line.

DDEChannel = Application.DDEInitiate(app:="RSLINX", topic:="CTLGX")





我可以在使用控制器制造商服务器时看到客户端和数据,所以我知道主题是正确的,我下载并安装了W7 64的修补程序。我很绝望,所以任何帮助都会很棒。



任何建议都会有所帮助,我现在仍然坚持使用DDE。



I can see the client and the data when using the controller manufacturers server so I know the topic is correct, I downloaded and installed a hotfix for W7 64. I am desparate so ANY help would be great.

Any suggestions would be helpful, I am stuck with DDE for now.

推荐答案

尝试申报 DDEChannel 变量,然后尝试捕获错误,例如,以这种方式:

Try to declare DDEChannel variable, then try to catch an error, for example, in this way:
Option Explicit

Sub TestDDE()

Dim DDEChannel As Long

On Error GoTo Err_TestDDE

DDEChannel = Application.DDEInitiate(App:="RSLINX", Topic:="CTLGX")
Application.DDETerminate (DDEChannel)


Exit_TestDDE:
    Exit Sub
    
Err_TestDDE:
    MsgBox Err.Description, vbExclamation, Err.Number
    Resume Exit_TestDDE
End Sub





更多关于错误处理/陷阱,你会在这里找到:http://support.microsoft.com/kb/146864 [ ^ ]



在VB / VBA中使用DDE - 有用的链接:

XL2000:使用DDE的VB示例 [ ^ ]

http ://support.sas.com/resources/papers/proceedings12/077-2012.pdf [ ^ ]

http://fa.sammicomputer.co.kr/TECH/html/performi.htm [ ^ ]



兄弟Google说Win Vista上的DDE / 7 64b可能会产生一些问题EMS。阅读这些文章:

http://social.technet.microsoft.com/Forums/en-US/excel/thread/7c8f845d-c4aa-4627-9008-3251d2772536 [ ^ ]

< a href =http://social.technet.microsoft.com/Forums/en-US/office2007deploymentcompatibility/thread/c42f825d-b7e8-48c8-b5af-30563b839f09> http://social.technet.microsoft.com/Forums / en-US / office2007deploymentcompatibility / thread / c42f825d-b7e8-48c8-b5af-30563b839f09 [ ^ ]



More about error handling/trapping, you''ll find here: http://support.microsoft.com/kb/146864[^]

Using DDE in VB/VBA - useful links:
XL2000: VB examples using DDE[^]
http://support.sas.com/resources/papers/proceedings12/077-2012.pdf[^]
http://fa.sammicomputer.co.kr/TECH/html/performi.htm[^]

Brother Google "says" that DDE on Win Vista/7 64b may generate some problems. Read these articles:
http://social.technet.microsoft.com/Forums/en-US/excel/thread/7c8f845d-c4aa-4627-9008-3251d2772536[^]
http://social.technet.microsoft.com/Forums/en-US/office2007deploymentcompatibility/thread/c42f825d-b7e8-48c8-b5af-30563b839f09[^]


谢谢



我会读取链接,尝试捕获,并重新发布。

DDEChannel被声明为Lon g。
Thank you

I will read links, try catch, and repost.
DDEChannel is declared as a Long.


DDE频道正在打开,我正在使用以下代码打开频道。

DDE Channel is opening, I am using following code to open channel.
OpenRSLinx = DDEInitiate("RSLINX", "Sandbox")



以下从处理器获取数据。


And the following to get data from processor.

rslinx = OpenRSLinx()



此行返回错误2023


And this line returns error 2023

ValveName = DDERequest(rslinx, "Reals[" & i & "], L1, C1")



Excel放置#REF!在目标单元格中​​。


Excel places #REF! in the target cell.


这篇关于执行代码时收到类型错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆