Windows Task Scheduler 工作排程,程式中使用CreateOleObject操作Excel,出現錯誤訊息
Exception class name:
EOleException
EOleException
Exception message:
The file name or path does not exist.
The file is being used by another program.
The workbook you are trying to save has the same name as a currently open workbook
The file name or path does not exist.
The file is being used by another program.
The workbook you are trying to save has the same name as a currently open workbook
Microsoft Excel cannot access the file 'D:\xxxxxx'. There are several possible reasons:
手動建立資料夾
for 64 bit Windows
C:\Windows\SysWOW64\config\systemprofile\Desktop
for 32 bit Windows
C:\Windows\System32\config\systemprofile\Desktop
設定完成後再次登出,讓系統自動執行,接著出現以下錯誤訊息
Exception class name:
EOleSysError
Exception message:
The server process could not be started because the configured identity is incorrect.
Check the username and password, ProgID: "Excel.Application"
DCOM Config
控制台 -> 系統管理工具 -> 元件服務 ,或是在命令提示字元輸入 dcomcnfg
如果沒有看到Microsoft Excel Application選項,可以試著在命令提示字元裡操作
MMC comexp.msc /32
後來試著在Security加入使用帳號
Identity 選用 The laumching user.
沒有留言:
張貼留言