PC Review


Reply
Thread Tools Rate Thread

declaration help please

 
 
Gary Keramidas
Guest
Posts: n/a
 
      27th Apr 2010
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


 
Reply With Quote
 
 
 
 
Helmut Meukel
Guest
Posts: n/a
 
      27th Apr 2010
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" <(E-Mail Removed)> schrieb im Newsbeitrag
news:e%(E-Mail Removed)...
>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
>
>



 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      27th Apr 2010
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" <(E-Mail Removed)> wrote in message
news:e#(E-Mail Removed)...
> 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
>
>

 
Reply With Quote
 
Gary Keramidas
Guest
Posts: n/a
 
      28th Apr 2010
ok, thanks.

--


Gary Keramidas
Excel 2003


"Rick Rothstein" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:e#(E-Mail Removed)...
>> 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
>>
>>


 
Reply With Quote
 
Gary Keramidas
Guest
Posts: n/a
 
      28th Apr 2010
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> schrieb im Newsbeitrag
> news:e%(E-Mail Removed)...
>>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
>>
>>

>
>


 
Reply With Quote
 
ryguy7272
Guest
Posts: n/a
 
      28th Apr 2010
I'd say Variant; slower but works for everything.


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Rick Rothstein" wrote:

> 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" <(E-Mail Removed)> wrote in message
> news:e#(E-Mail Removed)...
> > 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
> >
> >

> .
>

 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      28th Apr 2010
Personally, I dislike Variants... you end up trusting VB to handle all the
behind the scene conversions for you. Do you think that is necessarily a
good thing to do? Lets say we have these two variant assignments...

V1 = "123"
V2 = "456"

What do you think this line will display...

MsgBox V1 + V2

--
Rick (MVP - Excel)



"ryguy7272" <(E-Mail Removed)> wrote in message
news:5FDF6FA8-7629-4095-B287-(E-Mail Removed)...
> I'd say Variant; slower but works for everything.
>
>
> --
> Ryan---
> If this information was helpful, please indicate this by clicking ''Yes''.
>
>
> "Rick Rothstein" wrote:
>
>> 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" <(E-Mail Removed)> wrote in message
>> news:e#(E-Mail Removed)...
>> > 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
>> >
>> >

>> .
>>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
if declaration =?Utf-8?B?YXNodzE5ODQ=?= Microsoft Excel Programming 2 30th Jan 2006 07:35 PM
Declaration name Robert Hargreaves Microsoft Excel Programming 4 6th Jun 2005 04:48 PM
event-declaration vs interface-event-declaration Alex Sedow Microsoft C# .NET 1 26th Dec 2004 11:03 PM
which declaration to use Peer Microsoft Excel Programming 3 2nd Aug 2004 03:17 PM
Declaration? TJF Microsoft Excel Programming 5 18th Dec 2003 03:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:32 PM.