In computer programming, it's good practice to release all objects from memory when you're done using them to make sure running processes are not left running in the background. Excel processes may stay active when you're programming using the Microsoft Excel Object Library, and Excel application objects are not released. In VBA you can use the "Shell" function to execute "Taskkill" to forcefully end an Excel process.
- Skill level:
- Moderately Easy
Other People Are Reading
Launch Microsoft Word, click the "Developer" tab, and click "Visual Basic." Click the "Insert" menu and click "Module" to add a new VBA code module.
Create a new sub procedure by typing the following code:
Private Sub killExcelProcess()
Declare a new variable and define the Excel process:
Dim xlsProcess As String
xlsProcess = "TASKKILL /F /IM Excel.exe"
Type the following line of code to kill the Excel process:
Shell xlsProcess, vbHide
Finish the procedure by typing "End Sub." Press "F5" to run the procedure.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for