I have a project that has five manual stations. Each station has a load cell. I wanted to take readings from each load cell through DDE and dump that into Excel.
I've written very little of VB and VB Script so my knowledge of how Visual Basic behaves is limited.
Each of my stations can trigger at different times, operator driven. Can I write my "trigger" code in Excel (VB Script) in five different sub routines, and will VB Script (VB Code) multitask the triggers?
So no matter what trigger is fired from any of the stations, will each of the five sub routines run independently in VB?
Even if I call Trigger2 and call Trigger3 at the SAME TIME, will both sub routines run simultaneously?
Something like this:
| CODE |
| Sub Trigger1() RSIchan = DDEInitiate("RSLinx", "STATION1") 'opens DDE link data = DDERequest(RSIchan, "F11:0") ‘assign “DATA” to F11:0 Windows("logger.xls").Activate 'looks for sheet logger Sheets("LOG").Select 'Make Sure Log sheet is Active Cells(1, 1).Value = data 'read word 0 DDETerminate (RSIchan) 'close DDE link Sub Trigger2() RSIchan = DDEInitiate("RSLinx", "STATION2") 'opens DDE link data = DDERequest(RSIchan, "F11:1") ‘assign “DATA” to F11:1 Windows("logger.xls").Activate 'looks for sheet logger Sheets("LOG").Select 'Make Sure Log sheet is Active Cells(1, 2).Value = data 'read word 1 DDETerminate (RSIchan) 'close DDE link Sub Trigger3() RSIchan = DDEInitiate("RSLinx", "STATION3") 'opens DDE link data = DDERequest(RSIchan, "F11:2") ‘assign “DATA” to F11:2 Windows("logger.xls").Activate 'looks for sheet logger Sheets("LOG").Select 'Make Sure Log sheet is Active Cells(1,32).Value = data 'read word 2 DDETerminate (RSIchan) 'close DDE link |