Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB6 VB VBA
is there a way to find the currently open file from Excel or Word process etc? , i want to get all the list of running processes in windows and which files they currently have open.
 
Thanks in advance!
Posted 19-Apr-12 1:28am
Edited 19-Apr-12 1:37am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

http://www.mattsbits.co.uk/item-150.html[^]
 
I copied part of your question and searched Google. This is the first hit I found.
 
-- good luck.
  Permalink  
Comments
micheal_jhones at 19-Apr-12 7:26am
   
this code shows windows title not current runing file
Slacker007 at 19-Apr-12 7:55am
   
I guess what I was hinting at was to do a thorough search on Google first and do some personal research and/or leg work. :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Test it:
Option Explicit
 
Sub EnumWordRunningFiles()
Dim WrdApp As Object, file As Object
 
On Error GoTo Err_EnumWordRunningFiles
 
Set WrdApp = GetObject(, "Word.Application")
For Each file In WrdApp.Documents
    MsgBox file.FullName, vbInformation, "Message"
Next
 
Exit_EnumWordRunningFiles:
    Set WrdApp = Nothing
    Exit Sub
 
Err_EnumWordRunningFiles:
    MsgBox Err.Description, vbExclamation, "Error No. " & Err.Number
    Resume Exit_EnumWordRunningFiles
End Sub
 

Sub EnumExcelRunningFiles()
Dim ExcApp As Object, file As Object
 
On Error GoTo Err_EnumExcelRunningFiles
 
Set ExcApp = GetObject(, "Excel.Application")
For Each file In ExcApp.Workbooks
    MsgBox file.Name, vbInformation, "Message"
Next
 
Exit_EnumExcelRunningFiles:
    Set ExcApp = Nothing
    Exit Sub
 
Err_EnumExcelRunningFiles:
    MsgBox Err.Description, vbExclamation, "Error No. " & Err.Number
    Resume Exit_EnumExcelRunningFiles
End Sub
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 315
1 Jochen Arndt 190
2 DamithSL 125
3 PIEBALDconsult 110
4 Garth J Lancaster 90
0 OriginalGriff 5,790
1 DamithSL 4,601
2 Maciej Los 4,012
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,195


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 10 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100