VBA Application.Trim文本长度限制

n A 1 Reputation point
2021-04-13T15:47:11.347+00:00

您好,当我试图写一个VBA程序时遇到了很糟糕的错误,希望能得到您的帮助。
Sub tests()
Dim prr, s
tp = 1000
td = -4
ReDim prr(Abs(td) + Abs(tp))
y = 0
For i = td To tp
prr(y) = i
y = y + 1
Next
prr(1) = " "
prr(2) = " "
s = Application.Trim(Join(prr))
End Sub

当tp = 1000时可以顺利运行,但
当tp = 10000时报错,应用程序定义或对象定义错误。如下图
87363-w.png

Community Center | Not monitored
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2021-04-13T18:05:14.21+00:00

    QnA forums are currently English only. I'd try asking for help over here in dedicated forums.
    https://social.msdn.microsoft.com/Forums/zh-cn/home

    --please don't forget to Accept as answer if the reply is helpful--


  2. Tom van Stiphout 40,186 Reputation points MVP Volunteer Moderator
    2021-04-13T17:54:47.457+00:00

    We speak English in this forum.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.