Sign in to follow this  
Followers 0
pete3589

Interesting DDE Issue

5 posts in this topic

Im making a DDE communication Excel spreadsheet that will upload and download tag values. Since several people at my company use different DDE topics I decided to make that a user configurable entry depending on what was used. The code looks like this: Dim DDE As Variant DDE = Worksheets("Set Points").Range("L4").Value Import = DDEInitiate("RSLinx", DDE) Where the entry for the DDE link is entered on the "Set Points" page in location L4. Interestingly, when I run I get a popup that gives me a list of DDE topics configured in my RSLinx (not all available, but a good amount) and asks me to pick the proper one, and then the code executes. Im curious why it wont just use the DDE link i enter in the cell? If i use Import = DDEInitiate("RSLinx", "TheTopicName") everything executes fine, so I dont understand why if i use a cell value it would create a problem. Any input would be appreciated.

Share this post


Link to post
Share on other sites
I have never really tried to do what you are doing with DDE but I have ran into this with VB. I don't know the technical reason for it but when you try to use a variable in place a value that requires quote around it this can happen Few thoughts though not tested DDE = "RSLinx," + Worksheets("Set Points").Range("L4").Value Import = DDEInitiate(DDE) DDE = "'RSLinx'," + Worksheets("Set Points").Range("L4").Value Import = DDEInitiate(DDE) DDE = "'RSLinx','" + Worksheets("Set Points").Range("L4").Value + "'" Import = DDEInitiate(DDE)

Share this post


Link to post
Share on other sites
Thanks for the input, but Excel has issues with Import = DDEInitiate(DDE) (argument not valid) I think I may just leave it as a static value and will just have to make an effort to get everyone to use the same DDE topic for their projects. Like the new avatar as well TW

Share this post


Link to post
Share on other sites
The spreadsheet I developed a few years back uses multiple topics selected from a combo box. The command looks like this: TopicName = Range("K3") RSIchan = DDEInitiate("\\IOSERVER\RSLinx", TopicName) The linked cell in the combo box is K3. The "\\IOSERVER\" is there because I ran my spreadsheet on computers that did not have RSLinx Pro loaded. I used the same copy the HMI was using to reach the PLCs. I was using the same topics too. My version looks a lot like what Pete started out with (not surprising it's right out of RSLinx Help file). Do you really need to call out the worksheet name? I'd drop that and the ".Value" and try again. I'm thinking those dots might be causing a problem. A couple of suggestions for troubleshooting: Display your DDE variable. The contents may not be turning out as expected. Dim your DDE variable as String. You can get some surprising results from a Variant. Good luck,

Share this post


Link to post
Share on other sites
I don't declare mine as a string. This could be part of my problem that causes me to go through hoops to get it to work. Thanks for the tip Thanks, Pseudoguas did a poll on it. Did you vote? http://forums.mrplc.com/index.php?showtopic=7979

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0