Het onderstaande vb-script draagt zorgt voor de installatie van een op te geven Excel AddIn. Wanneer de AddIn reeds aanwezig is zal deze eerst verwijderd worden, alvorens de nieuwe wordt geinstalleerd.
06 | excelAddIn = "AddIn.xlam" |
11 | Set objExcel = GetObject(, "Excel.Application" ) |
14 | If Not objExcel Is Nothing Then |
15 | WScript.Echo "Sluit Excel en probeer opnieuw!" |
17 | Set objExcel = CreateObject( "Excel.Application" ) |
18 | objExcel.Visible = False |
19 | Set objFSO = CreateObject( "Scripting.FileSystemObject" ) |
20 | startupPath = objExcel.startupPath & "\" |
22 | If objFSO.FileExists(startupPath & excelAddIn) Then |
23 | objFSO.DeleteFile startupPath & excelAddIn |
24 | MsgBox "Oud bestand verwijderd." , vbInformation, "Deinstallatie succesvol" |
27 | objFSO.CopyFile excelAddIn, startupPath & excelAddIn |
29 | MsgBox "Nieuw bestand gekopieerd naar opstartdirectory van Excel." , vbInformation, "Installatie succesvol" |