gpt4 book ai didi

vbscript - 打开 Excel 文件时出现错误 800a03ec

转载 作者:行者123 更新时间:2023-12-02 07:03:34 25 4
gpt4 key购买 nike

我编写了以下代码将 XLSX 文件转换为 CSV 格式:

If WScript.Arguments.Count < 2 Then
WScript.Echo "Error! Please specify the source path and the destination. Usage: XlsToCsv SourcePath.xls Destination.csv"
Wscript.Quit
End If

Dim oExcel
Set oExcel = CreateObject("Excel.Application")
Dim oBook
Set oBook = oExcel.Workbooks.Open(Wscript.Arguments.Item(0))
oBook.SaveAs WScript.Arguments.Item(1), 6
oBook.Close False
oExcel.Quit

当我为 XLSX 文件提供服务器路径时,它工作正常。但是,当我提供本地机器路径时,出现以下错误:

File could not be found. Check the spelling of the file name, and verify that file location is correct. If you are trying to open the file from list of most recently used files, make sure that file has not been renamed, moved or deleted
code: 800A03EC
Source: Microsoft Office Excel

最佳答案

万一有类似问题的人发现这个,错误代码似乎是一般的 Excel 错误,这意味着它无法打开文件。

在我的例子中,我尝试手动打开同一个文件,发现 Excel 想要修复损坏的文件。我被允许在验证不正确的情况下保存它,但它无法以编程方式打开。手动打开它意味着它可以显示一个对话框,询问我是否要修复它。

关于vbscript - 打开 Excel 文件时出现错误 800a03ec,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16394165/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com