Here is a screenshot of the relevant Excel Library
Here is a screenshot of the error
这是我的代码:
on saveExcelAsPDF(documentPath, PDFPath)
set tFile to (POSIX path of documentPath) as POSIX file
tell application "Microsoft Excel"
set isRun to running
set wkbk1 to open workbook workbook file name tFile
alias PDFPath
save workbook as wkbk1 filename PDFPath file format PDF file format with overwrite
close wkbk1 saving no
if not isRun then quit
end tell
end saveExcelAsPDF
当我尝试编译时,我收到错误警告,其中显示"语法错误;预期的行尾等,但找到标识符"和第二个"工作簿"第6行突出显示了这个词。我做错了什么?
谢谢!
答案 0 :(得分:0)
我明白了!当我使用该行'告诉应用程序" Microsoft Excel"'时,它指的是Windows版本的Excel(通过parallels桌面运行),而不是Excel for Mac。我用' tell application" / Applications / Microsoft Excel.app"'替换了那一行。它现在完美地编译。