Advertisement
Hippolito

Untitled

Mar 29th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. $Patch_Source=""
  2. $Patch_Dist="\\network folder\"
  3.  
  4.  
  5. $ExcelRD = New-Object -ComObject Excel.Application
  6.  
  7. # Создаём Excel
  8. $filePath = "\\another network folder\\TEST.xlsm"
  9.  
  10. $xlExcel8 = 56
  11.  
  12. # Делаем Excel видимым
  13. $ExcelRD.Visible = $true
  14.  
  15. # Отключаем уведомления
  16. $ExcelRD.DisplayAlerts = $false;
  17.  
  18. # Добавляем рабочую книгу
  19. $WorkBook = $ExcelRD.Workbooks.Open($filePath)
  20.  
  21. # Цепляемся к ExcelRD листу
  22. $WorkSheet = $ExcelRD.WorkSheets.Item(1)
  23.  
  24. # Обновляем
  25. $ExcelRD.ActiveWorkbook.RefreshAll();
  26.  
  27. $Filename = 'Bla-Bla-Bla'
  28. $MyDate = Get-Date -Format d
  29. $Collect = 'Bla-Bla-Bla_'
  30. $Supplier = 'Bla-Bla-Bla_'
  31.  
  32. $Workbook.SaveAs($Patch_Dist+$Filename+$Supplier+$Collect+$MyDate+".xls",56)
  33.  
  34. $WorkSheet = $null
  35. $WorkBook.Close($false)
  36. $ExcelRD.Quit()
  37. $ExcelRD = $null
  38.  
  39. [GC]::Collect()
  40. [GC]::WaitForPendingFinalizers()
  41. [GC]::Collect()
  42. [GC]::WaitForPendingFinalizers()
  43.  
  44. $connection.Close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement