Taskmanager shows Excel after been closed

silentwolf

Well-known Member
Joined
May 14, 2008
Messages
1,216
Office Version
  1. 2016
Hi guys,

got following question regarding the taskmanager and an instant of Ms Excel after running codes.

I got a form in Access where I declared following variables

VBA Code:
Option Compare Database
Option Explicit

Private mappExcel As Excel.Application
Private mwkbExcel As Excel.Workbook
Private mwksExcel As Excel.Worksheet
Private mrngExcel As Excel.Range
Private mlastRow As Long
'
'

Below the code I am using..

Code:
Private Sub btnAction_Click()
    Select Case btnAction.Caption
        Case "Open"
            If MsgBox("Datei öffnen?", vbQuestion + vbYesNo) = vbYes Then
'                OpenExcelFile (Me!txtFilePath.Value)        ' If I use this code the Taskmanager gets cleared
                
                OpenExcelFileM (Me!txtFilePath.Value)      'With This code the Taskmanager keeps an instant of Excel
            Else
                Exit Sub
            End If
            
        Case "Update"
            If MsgBox("Datei aktualisieren?", vbQuestion + vbYesNo) = vbYes Then
                UpdateCSVFile (Me!txtFilePath.Value)
            Else
                Exit Sub
            End If
        
        End Select
        
End Sub

Code:
Public Function OpenExcelFile(strFilePath As String) As Boolean
    Dim appExcel As Excel.Application
    Dim myWorkbook As Excel.Workbook
    Dim myWorkSheet As Excel.Worksheet
    
    Set appExcel = HoleAnwendung("Excel.Application")
    
    If appExcel Is Nothing Then
        MsgBox "Kein Excel gefunden!", vbCritical, p_cstrAppTitel
        Exit Function
    Else
        Set myWorkbook = appExcel.Workbooks.Open(strFilePath, Local:=True)
        Set myWorkSheet = myWorkbook.Worksheets(1)
                
        appExcel.Visible = True
    End If

End Function

Code:
Public Function OpenExcelFileM(strFilePath As String) As Boolean
  
    Set mappExcel = HoleAnwendung("Excel.Application")
    
    If mappExcel Is Nothing Then
        MsgBox "Kein Excel gefunden!", vbCritical, p_cstrAppTitel
        Exit Function
    Else
        Set mwkbExcel = mappExcel.Workbooks.Open(strFilePath, Local:=True)
        Set mwksExcel = mwkbExcel.Worksheets(1)
                
        mappExcel.Visible = True
    End If

End Function

As mentioned in bold above the code with OpenExcelFileM keeps Excel running in the Taskmanager the OpenExcelFile does clean it out

So I was wondering if someone could tell me what I would need to change in order to be able to use the globel varibles in the form module

Many thanks for your help

Albert
 
Well I see you have continued this thread over on AWF, so I will leave this as it is.
Sorry this was not intentionally,
In here was the intention of asking about the taskmanager.
And over at AWF was more about the saveAs problem but as this is one and the same work it happend to got a bit mixed for better understanding.

Never do crossposting but it just happend as I mentioned.

Sorry again did not mean to do any harm!

Cheers anyway for your help!
 
Upvote 0

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Never do crossposting
That doesn't ring true. You posted this exact problem 2 years ago at AWF and claimed it was solved. Now you are posting the same issue here. That is cross posting. I'm also out of this one. Not because of the cross posting, but because it's an old issue that you said was solved. If it's not, I suggest you pick up where you left off over there with the same responders.
 
Upvote 0
That doesn't ring true. You posted this exact problem 2 years ago at AWF and claimed it was solved. Now you are posting the same issue here. That is cross posting. I'm also out of this one. Not because of the cross posting, but because it's an old issue that you said was solved. If it's not, I suggest you pick up where you left off over there with the same responders.
Thanks for your reply,

It was not the same issue! It is a new project and yes a similar problem.
With this one I used module varibles and close the workbook manually and was wondering how I could set those varibles to nothing so the task manager can be cleared.
That was not the case back at the other threat in AWF as the issues was within the code itself after closing the workbook.

And yes it was resolved and closed as I found the unquilified varibles.
I did not think that I would need to pick up the old threat with new issue. Well sorry about that!

Unfortunately I can't delete or close this threat here so noone can get offend by me.

But in the other hand I guess there are bigger problems in the world as starting a new threat or crossposting.

Cheers
 
Upvote 0
I sense a tone there and a bit of dancing around the issue. This is the title of your old thread
Excel in Task Manager not closing

This is the title of this thread
Taskmanager shows Excel after been closed

While you may have had subtle differences in what lies beneath either one of them I don't think you can blame anyone for thinking they are for the most part, the same issue and that you'd have been better off continuing there.

You might think nothing of cross posting without declaring it and that is your right to do so. If I didn't post a link to why it's considered impolite then here it is, that it might shed some light on the subject for you.
Cross Posting Message
 
Upvote 0
I sense a tone there and a bit of dancing around the issue. This is the title of your old thread
Excel in Task Manager not closing

This is the title of this thread
Taskmanager shows Excel after been closed

While you may have had subtle differences in what lies beneath either one of them I don't think you can blame anyone for thinking they are for the most part, the same issue and that you'd have been better off continuing there.

You might think nothing of cross posting without declaring it and that is your right to do so. If I didn't post a link to why it's considered impolite then here it is, that it might shed some light on the subject for you.
Cross Posting Message
Hi Mircon,

I do understand those rules and again I do appologize that I had not providet a link to an old post!
Unfortunatelly I can not change it anymore but will definitely keep it in mind for the future.

Cheers
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top