DrDonut
DrDonut

Reputation: 904

Suppress error message when opening Excel file

A number of Excel files that need to be opened have a problem, they only consist of an .xml file with the table, missing some other files that are usually in the .xlsx container. When opening a file like this in Excel, I get this message:

Excel Error Message

All I need to do here is press Enter and the file loads.

I need to open a bunch of these files from a Powershell script, how can I suprpress this message?

Currently, the workbooks are opened like this:

$destExc = new-object -ComObject Excel.Application;
$bulkBook = $destExc.Workbooks.Open($bulkXMLList[$i].FullName)

Which prompts said message, after which the script continues.

Upvotes: 1

Views: 2398

Answers (1)

user6811411
user6811411

Reputation:

Did you try:

$Excel = New-Object -ComObject Excel.Application
$Excel.DisplayAlerts = $False

Upvotes: 3

Related Questions