@@ -40,7 +40,7 @@ public class ExcelGetRangeCommandAsDT : ScriptCommand
40
40
[ Attributes . PropertyAttributes . Remarks ( "" ) ]
41
41
public string v_Output { get ; set ; }
42
42
[ XmlAttribute ]
43
- [ Attributes . PropertyAttributes . PropertyDescription ( "Please Enter the Second Cell Location (ex. A1 or B2)" ) ]
43
+ [ Attributes . PropertyAttributes . PropertyDescription ( "Please Enter the Second Cell Location (ex. A1 or B2, Optional )" ) ]
44
44
[ Attributes . PropertyAttributes . PropertyUIHelper ( Attributes . PropertyAttributes . PropertyUIHelper . UIAdditionalHelperType . ShowVariableHelper ) ]
45
45
[ Attributes . PropertyAttributes . InputSpecification ( "Enter the actual location of the cell." ) ]
46
46
[ Attributes . PropertyAttributes . SampleUsage ( "A1, B10, [vAddress]" ) ]
@@ -73,7 +73,16 @@ public override void RunCommand(object sender)
73
73
74
74
Microsoft . Office . Interop . Excel . Application excelInstance = ( Microsoft . Office . Interop . Excel . Application ) excelObject ;
75
75
Microsoft . Office . Interop . Excel . Worksheet excelSheet = excelInstance . ActiveSheet ;
76
- var cellValue = excelSheet . Range [ targetAddress1 , targetAddress2 ] ;
76
+ Microsoft . Office . Interop . Excel . Range cellValue ;
77
+ if ( targetAddress2 != "" )
78
+ cellValue = excelSheet . Range [ targetAddress1 , targetAddress2 ] ;
79
+ else
80
+ {
81
+ Microsoft . Office . Interop . Excel . Range last = excelSheet . Cells . SpecialCells ( Microsoft . Office . Interop . Excel . XlCellType . xlCellTypeLastCell , Type . Missing ) ;
82
+ cellValue = excelSheet . Range [ targetAddress1 , last ] ;
83
+ }
84
+
85
+
77
86
if ( v_Output == "Datatable" )
78
87
{
79
88
@@ -142,7 +151,6 @@ public override void RunCommand(object sender)
142
151
143
152
}
144
153
string output = String . Join ( "," , lst ) ;
145
- v_ExcelCellAddress1 = output ;
146
154
147
155
//Store Strings of comma seperated values into user variable
148
156
output . StoreInUserVariable ( sender , v_userVariableName ) ;
0 commit comments