Check if excel application is running

Check if excel application is running

william
Advocate Advocate
1,015 Views
2 Replies
Message 1 of 3

Check if excel application is running

william
Advocate
Advocate

Hello Everybody

I need some help how to achieve this in ilogic.

I would like to be able to check and see if excel is already open. Check that the excel application is running. 

If the excel application is open, it willl be an unsaved workbook, created by a previous rule. 

 

I have spent some time looking through the forums and VB.Net forums but i havent had any luck yet. The closest threads that I could find are below, but I couldnt get them to work. 

https://forums.autodesk.com/t5/inventor-customization/code-to-check-if-a-file-is-open/td-p/5432055

https://www.vbforums.com/showthread.php?842295-Check-to-if-Excel-is-open-and-then-close-it

https://stackoverflow.com/questions/51770013/get-running-instances-of-excel-with-vb-net

https://stackoverflow.com/questions/9373082/detect-whether-excel-workbook-is-already-open

 

Is there a simple way to do this? I dont know my way around VB.Net code very well, and still learning on the ilogic too. 

Appreciate any help. 

 

0 Likes
Accepted solutions (1)
1,016 Views
2 Replies
Replies (2)
Message 2 of 3

bradeneuropeArthur
Mentor
Mentor
Accepted solution
 Try
            For Each p In Process.GetProcesses

                If p.ProcessName = "EXCEL" Then


                        p.Kill()
                        BolExcelRunning = False
                    End If
                End If
            Next
        Catch ex As Exception

        End Try

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 3

william
Advocate
Advocate

Thanks @bradeneuropeArthur 

I modified it slightly to what I wanted and it works great. 

 

ExcelRunning = False
Try
	For Each p In Process.GetProcesses
		If p.ProcessName = "EXCEL" Then
			ExcelRunning = True
			MessageBox.Show("Excel is running", "Title")
		End If
	Next
Catch ex As Exception
End Try	

If ExcelRunning = False Then 
	MessageBox.Show("Excel is not running", "Title")
End If