在Excel中printArea中的最大字符串长度 [英] Maximum String Length of PrintArea in Excel
问题描述
什么是在Excel 2003和2010年?
What is the maximum string length of PrintArea in Excel 2003 and 2010?
我有677 printArea中字符串的长度printArea中的最大字符串长度。
I have a PrintArea string length of 677.
这在Excel 2003中抛出一个错误,而不是在2010年,所以我想知道的最大字符串长度是两个版本,以及在2007年。
This throws an error in Excel 2003, but not in 2010, so I'd like to know what the maximum string length is in both versions as well as 2007.
推荐答案
在2003年和2007年限制为255个字符。
The limit in 2003 and 2007 is 255 characters.
我没有2010的副本测试,但您可以使用此VBA代码轻松地测试它。只要运行宏并将其崩溃后,到调试,检查我的价值。一个不到,这将是最大的字符串长度。
I don't have a copy of 2010 to test, but you can use this VBA code to test it easily. Just run the macro and after it crashes, go to Debug, and check the value of i. One less than that will be the maximum string length.
Sub PrintRangeTest()
Dim i As Integer
Dim j As Integer
Dim newName As String
newName = ""
Dim rng As Range
For i = 1 To 100000 //some arbitrarily large number
newName = ""
For j = 1 To i
newName = newName & "a"
Next
Set rng = ActiveSheet.Range(Cells(1, 1), Cells(i, i))
rng.Name = newName
ActiveSheet.PageSetup.PrintArea = rng
Next
End Sub
这篇关于在Excel中printArea中的最大字符串长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!