# Respond to Excel prompts programatically

**URL:** <https://forums.powershell.org/t/respond-to-excel-prompts-programatically/12820>\
**Category:** PowerShell Help\
**Created:** [July 5, 2019, 8:57am UTC](https://forums.powershell.org/t/respond-to-excel-prompts-programatically/12820 "2019-07-05T08:57:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![crusher21](https://avatars.discourse-cdn.com/v4/letter/c/6a8cbe/32.png) [@crusher21](https://forums.powershell.org/u/crusher21)\
**Post date:** [July 5, 2019, 8:57am UTC](https://forums.powershell.org/t/respond-to-excel-prompts-programatically/12820/1 "2019-07-05T08:57:03Z")

</div>

I have a .xlsm file and I’m trying to convert it to a xlsx with the code below:

```
$objExcel = New-Object -comobject excel.application
$objExcel.Visible = $False
$doc = $objExcel.WorkBooks.Open($path)
$doc.SaveAs("$path\modified.xlsx",
[Microsoft.Office.Interop.Excel.XlFileFormat]::xlOpenXMLWorkbook)
$doc.close()

$objExcel.Quit()
$objExcel = $null
```

The only problem is that excel prompts me with the GUI every time saying “The following features cannot be saved in macro-free workbooks…”. I don’t care though.

How can I pipe a response to the prompt, as I would if there was a y/n confirmation in a cli command.

---

<div class="post-metadata">

**Author:** ![crusher21](https://avatars.discourse-cdn.com/v4/letter/c/6a8cbe/32.png) [@crusher21](https://forums.powershell.org/u/crusher21)\
**Post date:** [July 8, 2019, 12:18pm UTC](https://forums.powershell.org/t/respond-to-excel-prompts-programatically/12820/2 "2019-07-08T12:18:45Z")

</div>

Bump

---

<div class="post-metadata">

**Author:** ![david-schmidtberger](https://avatars.discourse-cdn.com/v4/letter/d/ba9def/32.png) [@david-schmidtberger](https://forums.powershell.org/u/david-schmidtberger)\
**Post date:** [July 9, 2019, 10:38am UTC](https://forums.powershell.org/t/respond-to-excel-prompts-programatically/12820/3 "2019-07-09T10:38:46Z")

</div>

i haven’t tested, but you could try piping it to out-null

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:31pm UTC](https://forums.powershell.org/t/respond-to-excel-prompts-programatically/12820/4 "2024-05-16T20:31:59Z")

</div>

Closed on May 16, 2024, 8:31pm UTC


