Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Vba - Checking if running

Hi all,

How can I check if excel application "Test.xls" is already runnig.
I need to run a macro which needs this book open, but it may be runnin
before macro activates itself.

must be something like:

aplication.running ("Test.xls") = true ...

Thanks,
Aldo

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Vba - Checking if running

If you want to see if the file is open:
http://support.microsoft.com?kbid=138621
XL: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=291295
XL2002: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=213383
XL2000: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=184982
WD97: VBA Function to Check If File or Document Is Open


if you want to see if it is open in the same instance of excel

Dim bk as Workbook
On Error Resume Next
set bk = Workbooks("Test.xls")
On Error goto 0
if not bk is nothing then
' Test.xls is open

If you mean something else, then perhaps you could provide a clearer
explanation.

--
Regards,
Tom Ogivy


"ajliaks " wrote in message
...
Hi all,

How can I check if excel application "Test.xls" is already runnig.
I need to run a macro which needs this book open, but it may be running
before macro activates itself.

must be something like:

aplication.running ("Test.xls") = true ...

Thanks,
Aldo.


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default Vba - Checking if running

Not sure what you mean by "running"? Workbooks don't "run", but macros do.
Does this workbook contain a macro that runs for a long time? If so, I don't
think any other code can run until it finishes.

OTOH, did you mean you want to know if the workbook is open? If so,

Dim sTemp As String
On Error Resume Next
sTemp = Workbooks("Test.xls").Name
If Err.Number < 0 Then
'code here to open the workbook
end if
On Error Goto 0

If you are averse to error trapping, you could set up a loop to go through all
open workbooks, checking their names:

Function TestIsOpen() As Boolean
TestIsOpen = False
For w = 1 To Workbooks.Count
If Workbooks(W).Name = "Test.xls" Then
TestIsOpen = True
Exit For
End If
Next w
End Function

On Sat, 11 Sep 2004 11:25:20 -0500, ajliaks
wrote:

Hi all,

How can I check if excel application "Test.xls" is already runnig.
I need to run a macro which needs this book open, but it may be running
before macro activates itself.

must be something like:

aplication.running ("Test.xls") = true ...

Thanks,
Aldo.


---
Message posted from http://www.ExcelForum.com/


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Spell Checking with checking cell notes jfitzpat Excel Discussion (Misc queries) 0 August 8th 07 10:26 PM
Checking and IF ? mohamadhafiz Excel Worksheet Functions 5 June 26th 07 11:04 PM
Day Checking K1KKKA Excel Discussion (Misc queries) 4 January 30th 07 08:19 PM
Checking to see that a CHART exists prior to running a simple command Anton Excel Discussion (Misc queries) 0 August 29th 06 06:30 AM
Add checking Pat Excel Worksheet Functions 5 December 17th 04 08:25 PM


All times are GMT +1. The time now is 05:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"