Type Mismatch Error help understanding
Hi Tom,
Thanks for the insight. I have not solved the problem yet but will keep
trying.
Regards,
Ray
Tom Ogilvy wrote in message
...
Dim aszTextArray As Variant
Dim CurSlot As ICAPLib.Slot
Dim nNum As Long
Set CurSlot = Component.ResultAttributes
If Not CurSlot Is Nothing Then
aszTextArray = CurSlot.ValueAsArray
nNum = UBound(aszTextArray) < I get the error here . At this
point, aszTextArray is Empty and CurSlot =""
Well you are getting type mismatch because CurSlot.ValueAsArray did not
return an array and aszTextArray therefore does not have an upperbound
(since it isn't an array).
if Component.ResutlAttributes should return an object (indicated by the
fact
that you use set and typed curslot as ICAPLIB.Slot), then it should return
Nothing if there is no slot, rather than "". But I would expect an
object
error on the set statement if it returned a null string.
--
Regards,
Tom Ogilvy
Ray Batig wrote in message
ink.net...
Hi Tom,
The code came from Aspen Icarus which is part of the Aspen Engineering
software suite. Icarus estimates the cost of projects in industrial
settings. ICAPLib is a library of equipment specific descriptors ie.
Slots.
Component.ResultAttributes are the slot values linked to individual
equipment. I seem to think that there is something wrong with the If
statement since CurSlot was = "" and thus it should have skipped the
Then
part.
Don't know if this helps or not, however, thanks for looking at it.
Ray
Tom Ogilvy wrote in message
...
None of your code looks like it has anything to do with Excel. What
is
an
ICAPLib and a Component.ResultAttributes?
Where did you get the code from? What was the code supposed to do?
--
Regards,
Tom Ogilvy
Ray Batig wrote in message
link.net...
I am using code developed by others as an example. In have made no
changes
to it so I presume it should work. Here it is:
Dim aszTextArray As Variant
Dim CurSlot As ICAPLib.Slot
Dim nNum As Long
Set CurSlot = Component.ResultAttributes
If Not CurSlot Is Nothing Then
aszTextArray = CurSlot.ValueAsArray
nNum = UBound(aszTextArray) < I get the error here . At
this
point, aszTextArray is Empty and CurSlot =""
What is this error trying to tell me? Any ideas if the If
statement
is
wrong?
Thanks in advance for your help.
Ray
|