adccommunitymod (AutomationDirect) asked a question.

Write Value from Excel to PLC

Created Date: April 19,2005

Created By: matthias

**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****

Hi! i have made a program in excel that communicates with a Koyo DL250 PLC thrue an OPC/DDE Server, it works fine to read values but i need to write or change status for some variables in PLC from Excel. when i tried to change status in the cell that contains formel below, the formel disapers. (i tried to make a paste special only value) (=kepdirectdde|_ddedata!Djuptest.PLC_250.c105 ) matthias


  • adccommunitymod (AutomationDirect)

    Created Date: April 19,2005

    Created by: matthias

    Hi!

    i have made a program in excel that communicates with a Koyo DL250 PLC thrue an OPC/DDE Server, it works fine to read values but i need to write or change status for some variables in PLC from Excel.

    when i tried to change status in the cell that contains formel below, the formel disapers. (i tried to make a paste special only value)

    (=kepdirectdde|_ddedata!Djuptest.PLC_250.c105 )

    matthias

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: April 19,2005

    Created by: Steven

    Here is a simple example in sending data through Excel. You can also refer to the software manaul and search this forum for other Excel-related posts.

    Basically, you need to write an Excel VBA macro. Here is one that illustrates the concept. This macro will send the data in the active cell to the location you specified:

    Sub SendData()

    Dim DDEchannel As Long

    'open DDE channel

    DDEchannel = DDEInitiate( "kepdirectdde ", "_ddedata ")

    'send data via DDE

    DDEPoke DDEchannel, "Djuptest.PLC_250.c105 ", ActiveCell

    'close DDE channel

    DDETerminate DDEchannel 'close DDE channel

    End Sub

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: April 20,2005

    Created by: matthias

    Tanks : )

    Matthias

  • adccommunitymod (AutomationDirect)

    Created Date: April 21,2005

    Created by: matthias

    Hi again : )

    Why can´t i have my own variable insted

    of ActiveCell

    i know For example that instead of ActiveCell i can type Range( "B12 ") it Works but i want to use an varaiable from VB prog. instead like

    Dim strCounter as String, but i can´t get it to work..... http://forum1.automationdirect.com/board/frown.gif

    DDEPoke DDEchannel, "Djuptest.PLC_250.c105 ", strCounter

    DDEPoke DDEchannel, "Djuptest.PLC_250.c105 ", ActiveCell

    Matthias

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: April 21,2005

    Created by: Steven

    I could never figure out why you couldn't use a variable instead of a cell reference when sending data, but as far as I know that is the case. It seems you do need to put data into a cell before sending it.

    What I do is create a hidden worksheet in the workbook with a named cell range, like "DataToSend ". I use this range whenever I need to send data.

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: April 22,2005

    Created by: matthias

    Hi!

    I´ve made a hidden worksheet, but it doesn´t feel right..... ;(

    thanks again Matthias