Need direction for help with Excel, please!

by TimT at 2013-04-15 15:18:50

Hi there, this is a NOOB alert. I am fairly new to PS, but used to script quite a bit.

If you would please direct me to the forum for Excel. I have a script (see below) that I need help on. After opening the Excel file, a popup will come up asking weather or nto you want to update the file. I do want to, but cannot find a way to automate that. It would occur where line 9 is.

Thanks! Any help is greatly appreciated!
Tim

$excel = new-object -comobject excel.application
$Excel.Visible = $False
$Excel.DisplayAlerts = $FALSE

$excelFiles = Get-ChildItem -Path “\earth\Reviewed Loans” -Include *.xls, *.xlsm -Recurse
Foreach($file in $excelFiles)
{
$workbook = $excel.workbooks.open($file.fullname)

$workbook.save()
$workbook.close()
}
$excel.quit()
by DonJ at 2013-04-15 15:22:27
Please see rule #3, above :).

Also, rule #1. :slight_smile: :slight_smile:

We don’t have a forum for Excel, and it can - as you see - be very complicated to work with. Can you attach a screen shot showing the popup in question? And also, can you identify which line of your script is line 9? The Close() method?
by TimT at 2013-04-15 15:49:48
Thank you again!

Line #9 would be the blank line right above the ‘$workbook.save()’ line.

The attached file is a screen shot I get when I run it. It is the same dialog box as if the excel program was showing behind it.

I can hit the ‘u’ key each time, but I have over 500 files to process.

Again - any help is appreciated.
by DonJ at 2013-04-15 15:52:25
Ah. Yeah, no way to automate that. Not that I ever found. Look into AutoIt - it’s a scripting language specifically for automating GUI stuff like this.