Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Check Excel's state to see if a workbook is loaded in App

Does anyone know if there is a way to check Excel App. to
see if there is actually a workbook open. I'm refferring
to the conditon where Excel is open but there is no
workbook open (loaded), I would like to cancel code from
running if the App. has no loaded workbook
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default Check Excel's state to see if a workbook is loaded in App


"Chris w." wrote in message
...
Does anyone know if there is a way to check Excel App. to
see if there is actually a workbook open. I'm refferring
to the conditon where Excel is open but there is no
workbook open (loaded), I would like to cancel code from
running if the App. has no loaded workbook


I guess you could use the ActiveWorkbook property:
http://msdn.microsoft.com/library/de...bjWorkbook.asp

/Fredrik



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Check Excel's state to see if a workbook is loaded in App

How about:

If ActiveWorkbook Is Nothing Then
MsgBox "no active workbook"
Exit Sub
End If

At the top of your procedure.

"Chris w." wrote:

Does anyone know if there is a way to check Excel App. to
see if there is actually a workbook open. I'm refferring
to the conditon where Excel is open but there is no
workbook open (loaded), I would like to cancel code from
running if the App. has no loaded workbook


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Check Excel's state to see if a workbook is loaded in App

Hi Chris,

It's not clear how you've opened or are controlling this
instance of Excel, but the following may help (It works as
a sheet event within a workbook in Excel):

Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
MsgBox Application.Workbooks.Count
End Sub

App.Workbooks.Count may get you there.

Best Regards,
Walt

-----Original Message-----
Does anyone know if there is a way to check Excel App. to
see if there is actually a workbook open. I'm refferring
to the conditon where Excel is open but there is no
workbook open (loaded), I would like to cancel code from
running if the App. has no loaded workbook
.

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
I am protecting my workbook, but it is broken when it is loaded by Quatro Pro, please help SAM SEBAIHI Excel Discussion (Misc queries) 4 February 5th 07 11:08 PM
Excel's Personal Macro Workbook Excel User Excel Worksheet Functions 1 January 26th 06 07:15 PM
How check if form is loaded? Jos Vens[_2_] Excel Programming 4 January 28th 05 12:34 PM
Unhiding workbook when loaded John H[_4_] Excel Programming 2 January 29th 04 07:11 PM
Do the Addins belong to a workbook, or are they global to all workbooks loaded? Chip Pearson Excel Programming 3 August 6th 03 11:01 PM


All times are GMT +1. The time now is 04:23 PM.

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

About Us

"It's about Microsoft Excel"