From: Gary Keramidas on 27 Apr 2010 16:29 a third party added some code to one of my apps and didn't dim anything. i'm not sure how to dim these variables. can someone help? a couple examples in the code: DDEChannel = Application.DDEInitiate(app:="RSLinx", topic:="T09113") DDEItem = "Xfer_Sched_New" 'Tag in CompactLogix DDEChannel = Application.DDEInitiate(app:="RSLinx", topic:="T09113") DDEItem = "Xfer_Schedule[" & Num_i & "],L1,C1" 'Schedule Tag in CompactLogix -- Gary Keramidas Excel 2003
From: Helmut Meukel on 27 Apr 2010 17:17 Gary, I never used DDE, it's outdated. DDEItem is obviously a string, and F1 used with DDEInitiate tells me: "If successful it returns the number of the DDE channel". So a Long would be fine. If you can't figure out what type to use (remember: F1 is your friend), you can always stay with Variants (as they did). Helmut. "Gary Keramidas" <gkeramidas(a)MSN.com> schrieb im Newsbeitrag news:e%23t9chk5KHA.5476(a)TK2MSFTNGP06.phx.gbl... >a third party added some code to one of my apps and didn't dim anything. i'm >not sure how to dim these variables. can someone help? > > a couple examples in the code: > > DDEChannel = Application.DDEInitiate(app:="RSLinx", topic:="T09113") > DDEItem = "Xfer_Sched_New" 'Tag in CompactLogix > > DDEChannel = Application.DDEInitiate(app:="RSLinx", topic:="T09113") > DDEItem = "Xfer_Schedule[" & Num_i & "],L1,C1" 'Schedule Tag in > CompactLogix > -- > > > Gary Keramidas > Excel 2003 > >
From: Rick Rothstein on 27 Apr 2010 18:10 You can probably ask VB to tell you. Put this line after after the first line... MsgBox TypeName(DDEChannel) and put this after the second line... MsgBox TypeName(DDEItem) and so on... VB should tell you what Data Type is stored in the Variants and you can then Dim each of those variables accordingly. -- Rick (MVP - Excel) "Gary Keramidas" <gkeramidas(a)MSN.com> wrote in message news:e#t9chk5KHA.5476(a)TK2MSFTNGP06.phx.gbl... > a third party added some code to one of my apps and didn't dim anything. > i'm not sure how to dim these variables. can someone help? > > a couple examples in the code: > > DDEChannel = Application.DDEInitiate(app:="RSLinx", topic:="T09113") > DDEItem = "Xfer_Sched_New" 'Tag in CompactLogix > > DDEChannel = Application.DDEInitiate(app:="RSLinx", topic:="T09113") > DDEItem = "Xfer_Schedule[" & Num_i & "],L1,C1" 'Schedule Tag in > CompactLogix > -- > > > Gary Keramidas > Excel 2003 > >
From: Gary Keramidas on 27 Apr 2010 19:33 thanks for the info. it's outdated and so was a lot of their other code. they were selecting everything in the code an i re-wrote a lot of it, dimming the variables, too. -- Gary Keramidas Excel 2003 "Helmut Meukel" <NoSpam(a)NoProvider.de> wrote in message news:uk7bA8k5KHA.3880(a)TK2MSFTNGP04.phx.gbl... > Gary, > > I never used DDE, it's outdated. > DDEItem is obviously a string, and F1 used with DDEInitiate tells me: > "If successful it returns the number of the DDE channel". > So a Long would be fine. > If you can't figure out what type to use (remember: F1 is your friend), > you can always stay with Variants (as they did). > > Helmut. > > > "Gary Keramidas" <gkeramidas(a)MSN.com> schrieb im Newsbeitrag > news:e%23t9chk5KHA.5476(a)TK2MSFTNGP06.phx.gbl... >>a third party added some code to one of my apps and didn't dim anything. >>i'm not sure how to dim these variables. can someone help? >> >> a couple examples in the code: >> >> DDEChannel = Application.DDEInitiate(app:="RSLinx", topic:="T09113") >> DDEItem = "Xfer_Sched_New" 'Tag in CompactLogix >> >> DDEChannel = Application.DDEInitiate(app:="RSLinx", topic:="T09113") >> DDEItem = "Xfer_Schedule[" & Num_i & "],L1,C1" 'Schedule Tag in >> CompactLogix >> -- >> >> >> Gary Keramidas >> Excel 2003 >> >> > >
From: Gary Keramidas on 27 Apr 2010 19:32
ok, thanks. -- Gary Keramidas Excel 2003 "Rick Rothstein" <rick.newsNO.SPAM(a)NO.SPAMverizon.net> wrote in message news:uC4sGal5KHA.5016(a)TK2MSFTNGP02.phx.gbl... > You can probably ask VB to tell you. Put this line after after the first > line... > > MsgBox TypeName(DDEChannel) > > and put this after the second line... > > MsgBox TypeName(DDEItem) > > and so on... VB should tell you what Data Type is stored in the Variants > and you can then Dim each of those variables accordingly. > > -- > Rick (MVP - Excel) > > > > "Gary Keramidas" <gkeramidas(a)MSN.com> wrote in message > news:e#t9chk5KHA.5476(a)TK2MSFTNGP06.phx.gbl... >> a third party added some code to one of my apps and didn't dim anything. >> i'm not sure how to dim these variables. can someone help? >> >> a couple examples in the code: >> >> DDEChannel = Application.DDEInitiate(app:="RSLinx", topic:="T09113") >> DDEItem = "Xfer_Sched_New" 'Tag in CompactLogix >> >> DDEChannel = Application.DDEInitiate(app:="RSLinx", topic:="T09113") >> DDEItem = "Xfer_Schedule[" & Num_i & "],L1,C1" 'Schedule Tag in >> CompactLogix >> -- >> >> >> Gary Keramidas >> Excel 2003 >> >> |