How to kill a process in vba
lord_in
Posted messages
44
Registration date
Status
Member
-
audalice Posted messages 1 Status Member -
audalice Posted messages 1 Status Member -
Hello,
I would like to know how to kill a process EXCEL.EXE in VBA
I am in VBA under Access
Thank you
I would like to know how to kill a process EXCEL.EXE in VBA
I am in VBA under Access
Thank you
Configuration: Windows Vista Firefox 2.0.0.8
6 answers
-
For using Taskkill, it seems that the VBA code should be written as:
vba.Interaction.Shell("TASKKILL /F /IM excel.exe") -
I found this
vba.Interaction.Shell("TASKKILL excel.exe /F /IM")
an interaction with the command prompt
if it doesn't work, add cmd.exe before taskkill
--
Are you having problems with IE8? I tell you THE solution, install firefox (search on google) -
Hello,
look here, if this can help:
https://www.developpez.net/forums/d275853/logiciels/microsoft-office/access/vba-access/api-supprimer-tache-vba-access/ -
Can the kill function work in a VBA program?
-
I have the same need, because in my database I want to create an Excel with data from the database.
When I run my function once, it works and creates an Excel. But on the second execution (without changing the data or the code), the function crashes on a Range and an EXCEL.EXE process is visible in the task manager even though I have no Excel open (at least none that is visible...)
Yet at the end of my function, I close my workbook and the "Excel application" object:
xlBook.Close xlApp.Quit Set xlSheet = Nothing Set xlBook = Nothing Set xlApp = Nothing
I think the best thing is to kill the process directly... -
Actually, the link provided above is not bad.
It's a bit heavy, but it works... The only problem is that I can't run my function with Excel open at the same time... And now, every other time (with great precision), it always throws an error on my Range saying that the remote server does not exist or is not available, even though I'm working locally -_-...
But I really don’t understand why it leaves a process at the end of my function... because in my opinion, that's what's causing the bug, like Excel with the same name.
'Initialisations Set xlApp = CreateObject("Excel.Application") Set xlBook = xlApp.Workbooks.Add 'Creation de la feuille budget Set xlSheet = xlBook.Worksheets.Add xlSheet.Name = "Budget" [...] Fonctions... [...] xlApp.DisplayAlerts = False xlBook.SaveAs chemin & "\Import\Budgets\Budgets " & Me.Liste_Annee.Value & " " & Format(Now, "yyyy-mm-dd - hhmmss") & ".xls" xlBook.Close xlApp.DisplayAlerts = True xlApp.Quit Abase.Close Set xlSheet = Nothing Set xlBook = Nothing Set xlApp = Nothing
And this isn’t the first time I’ve had problems with Ranges like this...