Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Type Mismatch Error help understanding
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Type Mismatch Error help understanding
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Type Mismatch Error help understanding
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Type Mismatch Error help understanding
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
<Tom Ogilvy Type Mismatch Error help understanding
Hi Tom,
With your guidance and some digging I determined that I had opened the Results, however, I had not loaded it. This did not provide any error message. Once I loaded and opened the results everything worked. Thanks again for your help and insight! Regards, Ray Ray Batig wrote in message link.net... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Visual Basic Error Run Time Error, Type Mismatch | Excel Discussion (Misc queries) | |||
Type Mismatch Error - Help Please | Excel Worksheet Functions | |||
Why type mismatch - R/T error 13 | Excel Discussion (Misc queries) | |||
Type Mismatch Error Need Help | Excel Programming | |||
Type mismatch error | Excel Programming |