Hi,
this script can be used to check if excel contains some active code. It opens the excel file in an safe way and looks for VB content and write the full file path to the console if macros are found.
Continue reading Powershell/Excel: Check if a excel document contains macros →
Hi,
if you tried to save a word or excel document as another format you got an error. For example, if you want to convert a CSV File to a Excel workbook and save it in Excel 95/97/2003 format.
[reflection.assembly]::LoadWithPartialName("Microsoft.Office.InterOp.Excel")
$oExcel = New-Object -ComObject "Excel.Application"
$sCSVFile="D:\temp\ImportFile.csv"
$oExcel.Visible = $true
$oCSVWorkbook=$oExcel.Workbooks.Add()
$oExcel.Workbooks.OpenText($sCSVFile)
$oCSVWorkbook.SaveAs("D:\temp\test.xls",[Microsoft.Office.Interop.Excel.XlFileFormat]::xlExcel9795)
Exception calling "SaveAs" with "1" argument(s): "SaveAs method of Workbook class failed"
At D:\test\CSV2Excel.ps1:29 char:20
+ $xl_workbook.SaveAs <<<< ("D:\Temp\test.xls")
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ComMethodTargetInvocation
Continue reading Powershell: Error while calling the SaveAs Method of some Office Applications →
My Knowledgebase for things about Linux, Windows, VMware, Electronic and so on…