M
Marco Shaw
Simple enough code below. If I chose something other than the default
..xlsx format to save a file, I get a prompt to save when trying to quit().
Is there a way around this? And also to force overwriting an existing
file, if found?
#remove-item c:\test_foo.xlsx
remove-item c:\test_foo.csv
$a = New-Object -comobject Excel.Application
$a.Visible = $True
$b = $a.Workbooks.Add()
$c = $b.Worksheets.Item(1)
$c.Cells.Item(1,1) = "A value in cell A1."
#$b.SaveAs("C:\test_foo.xlsx") <--no prompt to save when uncommented.
$b.SaveAs("C:\test_foo.csv",6)
$a.quit()
Marco
--
----------------
PowerGadgets MVP
http://www.powergadgets.com/mvp
Blog:
http://marcoshaw.blogspot.com
..xlsx format to save a file, I get a prompt to save when trying to quit().
Is there a way around this? And also to force overwriting an existing
file, if found?
#remove-item c:\test_foo.xlsx
remove-item c:\test_foo.csv
$a = New-Object -comobject Excel.Application
$a.Visible = $True
$b = $a.Workbooks.Add()
$c = $b.Worksheets.Item(1)
$c.Cells.Item(1,1) = "A value in cell A1."
#$b.SaveAs("C:\test_foo.xlsx") <--no prompt to save when uncommented.
$b.SaveAs("C:\test_foo.csv",6)
$a.quit()
Marco
--
----------------
PowerGadgets MVP
http://www.powergadgets.com/mvp
Blog:
http://marcoshaw.blogspot.com