$a = New-Object -comobject Excel.Application
$a.visible = $true
$path = "C:\powershell\source\"
$file1 = get-content "c:\powershell\source\sourcefile.txt"
$pathFile = $Path + $file1
$b = $a.Workbooks.Open($pathfile)
$c = $b.Worksheets.Item(7)
$fs = New-Object -ComObject scripting.filesystemobject
$absolutepath = $fs.GetAbsolutePathName("c:\powershell\Results\" + $file1)
$a.application.displayalerts = $false
$b.saveas($absolutepath)
$a.quit()
|