Click here to Skip to main content
12,454,104 members (54,380 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VBA
Hello

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

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

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.
Posted 11-Oct-12 5:23am
Updated 11-Oct-12 9:54am
v2
Comments
Sergey Alexandrovich Kryukov 11-Oct-12 11:54am
   
Who needs DDE these days, ever?!
--SA
Maciej Los 11-Oct-12 14:03pm
   
Very good question!
Sergey Alexandrovich Kryukov 11-Oct-12 15:30pm
   
Considering the history... when I had to start with networking, many Windows people tried to do NetDDE, and... TPC/IP... many did not know what it is, on Windows, NetBEUI dominated, NetBIOS -- can you imagine? and as to TCP/IP those people looked as "looks complex, difficult, some Unix stuff, who knows?..." I looked at that DDE and it seemed suspicious to me, what the hell? did not mess up, went with sockets... and now -- imagine how this DDE looks. :-)
--SA
jonsey29847 11-Oct-12 15:50pm
   
DDE is stil used in Autoplants, its legacy yes, but the consequences of changing it would be BIG bucks.
Sergey Alexandrovich Kryukov 11-Oct-12 15:53pm
   
Chances are, keeping it would result in even more bucks. :-)
--SA
jonsey29847 11-Oct-12 15:56pm
   
What makes you say that?
Sergey Alexandrovich Kryukov 11-Oct-12 17:15pm
   
Some experience... not with DDE, must admit :-)
--SA
jonsey29847 11-Oct-12 16:09pm
   
Not sure if first reply went through, as the auto companies retool the new technology surfaces. Recent advances in the processor now give us tag based addressing, a very big leap that took 20 years. Yes they do lag in technology, but even a small plant @ 500K square feet is $100 million just to build, tooling adds another $100 million or so, a final assembly plant runs into the billions. Yes its behind the times, but getting better, in 10 years I may not have to deal with DDE, and some suppliers have already abandoned it, but some of us still have to just deal.
Sergey Alexandrovich Kryukov 11-Oct-12 17:16pm
   
It all depends...
--SA
Wes Aday 11-Oct-12 16:01pm
   
What is DDEChannel declared as?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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

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[^]
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Thank you

I will read links, try catch, and repost.
DDEChannel is declared as a Long.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

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()
And this line returns error 2023
ValveName = DDERequest(rslinx, "Reals[" & i & "], L1, C1")
Excel places #REF! in the target cell.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160826.1 | Last Updated 1 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100