因为遍寻结果无果,特放首页恳请大侠执教:
碰到一个问题,
如果vbscript操作Excel的时候,进行数组赋值,却发现报这个错误.
仔细分析了一下,
发现数组中有个一个字符串长度大于了912,则赋值的时候,出错.
reDim
arrayobj2(
2
,
26
)
' 'print left range
arrayobj2( 0 , 0 ) = " 238 "
arrayobj2( 0 , 1 ) = " 167 "
arrayobj2( 1 , 0 ) = " 237 "
dim debugStr
for i = 1 to 1200
debugStr = debugStr & " f "
next
arrayobj2( 1 , 1 ) = debugStr
set nowRange2 = nowRange
set nowRange2 = nowRange2.Resize( 2 , 2 )
nowRange2.WrapText = true
Dim sData
sData = " FirstName " & vbTab & " LastName " & vbCr _
& " Bill " & vbTab & debugStr
' Clipboard.SetText sData
nowRange2.select
' 'call SetRangeNumberFormat("@",nowRange2,2,2)
nowRange2.value = arrayobj2
' 'print left range
arrayobj2( 0 , 0 ) = " 238 "
arrayobj2( 0 , 1 ) = " 167 "
arrayobj2( 1 , 0 ) = " 237 "
dim debugStr
for i = 1 to 1200
debugStr = debugStr & " f "
next
arrayobj2( 1 , 1 ) = debugStr
set nowRange2 = nowRange
set nowRange2 = nowRange2.Resize( 2 , 2 )
nowRange2.WrapText = true
Dim sData
sData = " FirstName " & vbTab & " LastName " & vbCr _
& " Bill " & vbTab & debugStr
' Clipboard.SetText sData
nowRange2.select
' 'call SetRangeNumberFormat("@",nowRange2,2,2)
nowRange2.value = arrayobj2
找到半天,也没有看见相关解决方法和产生的原因,
特请教各位大侠..