【问题标题】:DoCmd.OutputTo Method: Excel format that opens for Access 2003 and 2010DoCmd.OutputTo 方法:为 Access 2003 和 2010 打开的 Excel 格式
【发布时间】:2014-01-16 20:15:50
【问题描述】:

以下代码可在我的 Access 2010 上运行,但会给使用 Access 2003 的用户带来编译错误:

DoCmd.OutputTo acOutputReport, "trndOTrpt", "Excel97-Excel2003Workbook(*.xls)", "", False, "", , acExportQualityPrint

所以我将输出格式更改为acFormatXLS(根据this website's suggestion):

DoCmd.OutputTo acOutputReport, "trndOTrpt", acFormatXLS, "", False, "", , acExportQualityPrint

这会在我的 Access 2010(尚未测试 Access 2003)上打开,但只能以 Excel 5.0/95 工作簿格式打开。有没有办法可以在两个版本的 Access 中以正常的 97-03 .xls 格式打开它?

【问题讨论】:

    标签: vba ms-access methods


    【解决方案1】:

    Looking here 事实证明,Access 2003 的参数选项更少。所以我的最后 3 个参数 "", ,acExportQualityPrint 造成了问题,因此出现了完整的错误对话框“编译错误:参数数量错误或属性分配无效。”

    我最初尝试了 TransferSpreadsheet 方法,但将其导出到 Excel让用户选择保存名称和目的地变得太麻烦了。减少参数,OutputTo 效果很好!

    【讨论】:

      猜你喜欢
      • 2012-04-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-05
      • 1970-01-01
      相关资源
      最近更新 更多