【问题标题】:Every new file based on .xlt template should have code in it每个基于 .xlt 模板的新文件都应该有代码
【发布时间】:2022-06-11 08:54:14
【问题描述】:

我的软件使用 .xlt 模板在 .xls 中创建报告。

我的目标是每个新创建的 report.xls 都包含该代码并将一些数据发送到主列表。

Set From = Workbooks("path to the .xlt").Worksheets("bla") 不起作用。

我有 Excel 365。

【问题讨论】:

    标签: excel vba templates


    【解决方案1】:

    这样做:

    Dim wb as Workbook
    
    Set wb = Workbooks.Add("path to the .xlt")  ' add new workbook from template
    wb.SaveAs Filename:=<filename>, FileFormat:=xlOpenXMLWorkbook
    

    从这里选择文件格式:https://docs.microsoft.com/en-us/office/vba/api/excel.xlfileformat

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-10
      • 2021-05-14
      • 2017-04-02
      • 1970-01-01
      • 2020-05-05
      • 2018-07-16
      • 2016-02-01
      相关资源
      最近更新 更多