【问题标题】:Excel 2010 Text File Import Fixed Column WidthExcel 2010 文本文件导入固定列宽
【发布时间】:2014-10-28 14:33:03
【问题描述】:

我需要自动导入 .txt 文件并将列宽设置为特定标准。我知道可以使用分隔的数据来执行此操作,但我还没有找到固定宽度的来源。有什么建议吗?

【问题讨论】:

    标签: excel import automation fixed-width vba


    【解决方案1】:

    我找到了这篇文章。

    Change Row Height and Column Width using Excel VBA - 作者:Valli · 2013 年 5 月 18 日

    只要弄清楚实际需要的宽度是多少,就可以了。

    这些代码示例取自文章以节省您一些时间。

    Sub sbChangeColumnWidth()
    
    Columns("B").ColumnWidth = 25
    
    End Sub
    
    
    Sub sbChangeColumnWidthMulti()
    
    Columns("B:E").ColumnWidth = 25
    
    End Sub
    

    还有.Columns.AutoFit

    还有一些关于How column widths are determinied in Excel的资源:

    编辑:在底部添加链接

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-03
      • 1970-01-01
      相关资源
      最近更新 更多