View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
pk pk is offline
external usenet poster
 
Posts: 5
Default Is a visible workbook open?

Hello, please help on this...

I have an ending subroutine that resets a number of
application elements and is frequently called by any
number of other subroutines.

The only one that causes a problem is the following:

Application.Calculation = xlCalculationAutomatic

I frequently turn calculation off to speed up the code. In
some cases when the code ends, there may be no files open,
in which case the calculation line generates an error.

I really want to keep this code line in the ending
subroutine the way it is structured now. I need your
example code (one line if at all possible) to determine if
any files are open. For example, I tried this, but of
course it doesn't work:

If Not IsEmpty(ActiveWorkBook.Name) Then _
Application.Calculation = xlCalculationAutomatic

I would like something on this order if possible. Ideas?

Your example code most appreciated. Thanks in advance.