![]() ![]() |
I am using Excel with VBA to poll a CLX plc (actually five). If the DDE link is frozen or not responding while I am polling data, I want to be able to close the application. Any ideas? I was thinking of a while loop to put around the whole routine but am open to other ways.
![]() ![]() |
I would look at stop using DDE and move onto OPC (you would have to pay for this). it has always been easy to break the DDE connection. Instead of polling the PLC's why not do a worksheet change and have the PLCs trigger a cell. However for data archiving with a large amount of tags use OPC, I have found that http://www.opcware.com/opc_excel.html provides the best interfaces for excel.
Kevin
Kevin
![]() ![]() |
Hello K Grey,
Raising an error event is probably the cleanest and most efficient way to do this. This routine demonstrates how to raise the event, send an error number and close the application. Hope this helps you out.
I agree with Kevin that OPC is the next generation of DDE and Microsoft has threatened many times to obsolete DDE altogether.
jims [at] sytech.com
Raising an error event is probably the cleanest and most efficient way to do this. This routine demonstrates how to raise the event, send an error number and close the application. Hope this helps you out.
Public Sub RunRoutine()
On Error GoTo DDE_error
' DDE connection failed, raise the error
Err.Raise 5, "DDEFail"
DDE_error:
If Err.Number = 5 Then
' close DDE
' save the book and close
ActiveWorkbook.Save
Application.Quit
End If
End Sub
I agree with Kevin that OPC is the next generation of DDE and Microsoft has threatened many times to obsolete DDE altogether.
jims [at] sytech.com
Your use of this site is subject to the terms and conditions set forth under Legal Notices and the Privacy Policy. Please read those terms and conditions carefully. Subject to the rights expressly reserved to others under Legal Notices, the content of this site and the compilation thereof is © 1999-2013 Nerds in Control, LLC. All rights reserved.
Users of this site are benefiting from open source technologies, including PHP, MySQL and Apache. Be happy.
Fortune
The price of seeking to force our beliefs on others is that someday
they might force their beliefs on us.
-- Mario Cuomo








on 26 August, 2010 - 11:18 pm
