$_dollar$filepath = '$pathconvertfile$'
$_dollar$fileitem = Get-Item $_dollar$filepath
try {
$_dollar$excel = New-Object -ComObject Excel.Application
$_dollar$excel.Visible = $_dollar$false
$_dollar$excel.DisplayAlerts = $_dollar$false
$_dollar$wb = $_dollar$excel.Workbooks.Open($_dollar$fileitem.FullName)
$_dollar$pdfpath = $_dollar$fileitem.DirectoryName + """ + $_dollar$fileitem.BaseName + ".pdf"
$_dollar$wb.ExportAsFixedFormat(pMicrosoft.Office.Interop.Excel.XlFixedFormatType]::xlTypePDF, $_dollar$pdfpath)
$_dollar$wb.Close()
$_dollar$excel.Quit()
}
finally {
$_dollar$sheet, $_dollar$wb, $_dollar$excel | ForEach-Object {
if ($_dollar$_ -ne $_dollar$null) {
void]lSystem.Runtime.Interopservices.Marshal]::ReleaseComObject($_dollar$_)
}
}
}