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.
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.
- Photo Credit Comstock/Comstock/Getty Images
How to Run a Windows Application with Excel VBA
In some situations, you may want to open a second Windows application while still operating in another application such as Excel. VBA,...
How to Call an SQL Stored Procedure Using MS Access VBA
Knowing how to call a Microsoft SQL Server stored procedure from Microsoft Office Access using Visual Basic for Applications (VBA) can save...
How to Stop Macros in Excel
Macros are Visual Basic commands or programs that can integrate with some Microsoft Office programs, including Excel. However, macros that are programmed...
How to Zip Files Using VBA
When programming in Microsoft Office Visual Basic for Applications (VBA), it is sometimes necessary to open or call other programs from within...
How to Free Up Memory Space on a Computer
Free up memory space on a computer by selecting the task manager feature to access a list of running PC programs and...
Common VBA Commands in MS Excel
Common VBA Commands in MS Excel. VBA commands get MS Excel to do what you want -- and quicker than flipping through...
How to Use ActiveCell in Excel Using a VBA
If you work with Microsoft Office Excel often it's good to know how to use the "ActiveCell" property to add, get, and...