最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

powershell - Excel interop SaveAs error to the random file - Stack Overflow

programmeradmin1浏览0评论

Powershell with excel interop is saving to some random file. Here are few lines:

$outputExcelFile = Join-Path -Path $outputExcelFolder -ChildPath "$($fileName).xlsx"

Write-Host "Saving file $outputExcelFile ..."

$outputExcel.SaveAs($outputExcelFile)

On my Windows 10 it is saving just fine. On another PC error is happening:

Saving file C:\files\myexcel.xlsx Microsoft Excel cannot access the file 'C:\files\8142AA10'. There are several possible reasons:

  • 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.

What is 8142AA10?!! You can see variable name to save holds C:\files\myexcel.xlsx.

Any suggestions?

发布评论

评论列表(0)

  1. 暂无评论