DDE in Excel with type mismatch fault (13)

mulderm

Member
Join Date
Jun 2003
Location
Netherlands
Posts
298
Hello,

In Excel I have the follow VBA-code:
Const bit8 as integer = 256
dim channelnum as long
dim woord1 as integer, hulpwoord1 as integer
channelnum=DDEInitiate("RSLINX", "Topic")
woord1=DDERequest(channelnum, "N7:0")
hulpwoord1=woord1 / bit8 'giving type mismatch
DDETerminate channelnum

Problem: When I get the value of N7:0 (13112) I get a type
mismatch error nr:13 in my code by the row hulpwoord1.
Who knows the problem?
I want to convert the Integer N7:0 to 2 ascii karakters.
For N7:0=13112 LSD=8 and MSD=3

mulderm
 
Mulderm,
I think this "Const bit8 as integer = 256" is wrong, but I haven't used VB in a while. I don't think you can mix up commands on the same line without using a comma (,) between them.
In a debug window what value does bit8 have?
How about "dim bit8 as integer, bit8 = 256"

Mike
 
mulderm,
I think you can not use parameter in your code like:
woord1=DDERequest(channelnum, "N7:0")
Try to use parameter as cell of the spreadsheet like:
Cells(1, 1)=DDERequest(channelnum, "N7:0")
Also, you can request data from PLC to any cell of the spreadsheet by formula like:
=RSLINX|Topic!'N7:0'

hashem
 
By woord1 give it a mismatch.
When I place hulpwoord1 = 13112/bit8 it´s correct.
I can´t use cells(1,1) because I must add the value to
a variable named woord1.

mulderm
 

Similar Topics

This used to be an easy task in the past to get data into Excel, now I have 365, Excel just hangs when I paste the link. I've seen some guides to...
Replies
1
Views
1,225
Hi, I'm brand new to the forum and spent some time looking around but could not find an answer to my question. I'm using an excel spreadsheet to...
Replies
3
Views
1,326
Dear Friends; I copy the link of Tag value and paste it as a link in Excel but Cell shows #REF The images are attached where i am wrong...
Replies
1
Views
761
HI, I created a RSLINX OPC/DDE topic and then copied the link in to excel and I'm getting a #REF Error in the cells rather than the data, anyone...
Replies
4
Views
1,742
I didn't want to resurrect an old thread http://www.plctalk.net/qanda/showthread.php?t=7378&highlight=cx-server+dde But i'm trying to connect an...
Replies
7
Views
3,276
Back
Top Bottom