本文介绍了增加Excel PrintArea的最大字符串长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我问了一个关于Excel打印区域的最大字符串长度的问题:





打印区域设置为255,对于Excel 2010。



我认为这是一个只读属性,但是(在这里抓住吸管),有没有办法增加打印区域长度? Excel插件可能吗?



如果没有,我必须以编程方式设置一个新的打印区域,一旦达到最大255。



编辑



我已经尝试了以下答案:



范围(A1:C3,A5:B6,C7:D8,E1:E2,G1:G2,A10:A11,A13:A14,A16:A17,A19:A20,A22:A23,A25 :A26,A28:A29,A30:A31,A33:A35,A37:A38,A40:A41,A43:A44,A46:A47,A49:A50,A52:A53,A55:A56,A58:A59,A61:A63 ,A65:A66,A68:A69,A71:A72,A74:A75,A77:A78,A80:A81,A83:A84,A86:A87,A88:A89,A91:A92)Name =MyNamedRange



范围(A1:C3,A5:B6,C7:D8,E1 :E2,G1:G2,A10:A11,A13:A14,A16:A17,A19:A20,A22:A23,A25:A26,A28:A29,A30:A31,A33:A35,A37:A38,A40:A41 ,A43:A44,A46:A47,A49:A50,A52:A53,A55:A56,A58:A59,A61:A63,A65:A66,A68:A69,A71:A72,A74:A75,A77:A78,A80 :A81,A83:A84,A86:A87,A88:A89,A91:A92,A94:A95)Name =MyNamedRange



运行时错误1004 - (261个字符)



所以,我想现在我应该设置多iple Named Ranges,然后设置活动工作表打印区域,依次使用每个命名范围?



非常感谢。

解决方案

我将总打印区域打破了不超过255个字符的块。



我将每个块导出到一个单独的excel行,然后遍历每一行,设置excel打印区域,并打印,就像我去。


I asked a question a while back about the Maximum string length of Excel Print Area :

Maximum String Length of PrintArea in Excel

Print Area is set at 255, for Excel 2010.

I think this is a read-only property but (clutching at straws here), is there any way to Increase the Print Area length? Excel plug-in maybe?

If not, I'll have to programmatically set a new print area, once the maximum 255 has been reached.

EDIT:

I've tried the answer below :

Range("A1:C3,A5:B6,C7:D8,E1:E2,G1:G2,A10:A11,A13:A14,A16:A17,A19:A20,A22:A23,A25:A26,A28:A29,A30:A31,A33:A35,A37:A38,A40:A41,A43:A44,A46:A47,A49:A50,A52:A53,A55:A56,A58:A59,A61:A63,A65:A66,A68:A69,A71:A72,A74:A75,A77:A78,A80:A81,A83:A84,A86:A87,A88:A89,A91:A92").Name = "MyNamedRange"

Works fine - 253 characters.

Range("A1:C3,A5:B6,C7:D8,E1:E2,G1:G2,A10:A11,A13:A14,A16:A17,A19:A20,A22:A23,A25:A26,A28:A29,A30:A31,A33:A35,A37:A38,A40:A41,A43:A44,A46:A47,A49:A50,A52:A53,A55:A56,A58:A59,A61:A63,A65:A66,A68:A69,A71:A72,A74:A75,A77:A78,A80:A81,A83:A84,A86:A87,A88:A89,A91:A92,A94:A95").Name = "MyNamedRange"

Run- Time error 1004 -(261 characters)

So, I guess now I should set multiple Named Ranges, then set the Active Sheet Print Area, using each named range in turn?

Thanks very much.

解决方案

I broke the total Print Area into chunks of no more than 255 characters.

I exported each chunk into a separate excel row, then iterated through each row, setting the excel print area, and printing, as I went.

这篇关于增加Excel PrintArea的最大字符串长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 06:22