Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Running an excel macro from Powershell

$
0
0

Hello all!

I am trying to run an excel macro that's stored in a personal.xls file (in the XLSTART folder), in an automated script.  The problem is, I can run the macro when I put the commands in manually, but when thescript is running, I get: Exception calling "Run" with "31" argument(s): "'Personal.XLS' could not be found.

Here's the code for the macro section:

	$excel = new-object -comobject excel.application
	$workbook = $excel.workbooks.open("C:\test.xls")
	$worksheet = $workbook.worksheets.item(1)
	$excel.Run("Personal.XLS!FMT_PRICECHECKSTORE")
	$workbook.close()
	$excel.quit()
Thanks in advance for any assistance!


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>