Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default Is there a workbook open in Excel?

how do you tell in VBA if there is workbook open in excel. That is, when I
launch my xla, I want to check to see if there is at least one workbook open.
If not, I will prompt user to open workbook and exit the xla.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Is there a workbook open in Excel?

If workbooks.count0 then
end if

"ExcelMonkey" wrote:

how do you tell in VBA if there is workbook open in excel. That is, when I
launch my xla, I want to check to see if there is at least one workbook open.
If not, I will prompt user to open workbook and exit the xla.

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Is there a workbook open in Excel?

Be aware, this will count Personal.xls if there is one

--
HTH

Bob Phillips

"Hayeso" wrote in message
...
If workbooks.count0 then
end if

"ExcelMonkey" wrote:

how do you tell in VBA if there is workbook open in excel. That is,

when I
launch my xla, I want to check to see if there is at least one workbook

open.
If not, I will prompt user to open workbook and exit the xla.

Thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default Is there a workbook open in Excel?

If it counts personal workbooks then I likely cannot us it unless there is a
way for me to tell that it is a personal workbook. I am only interested in
regular workbooks.

EM

"Bob Phillips" wrote:

Be aware, this will count Personal.xls if there is one

--
HTH

Bob Phillips

"Hayeso" wrote in message
...
If workbooks.count0 then
end if

"ExcelMonkey" wrote:

how do you tell in VBA if there is workbook open in excel. That is,

when I
launch my xla, I want to check to see if there is at least one workbook

open.
If not, I will prompt user to open workbook and exit the xla.

Thanks




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Is there a workbook open in Excel?

Loop through the workbooks and check if they are hidden

Dim wb As Workbook
Dim Num As Integer
Num = 0
For Each wb In Application.Workbooks
If wb.Windows(1).Visible Then
Num = Num + 1
End If
Next
MsgBox Num


--
Regards Ron de Bruin
http://www.rondebruin.nl


"ExcelMonkey" wrote in message ...
If it counts personal workbooks then I likely cannot us it unless there is a
way for me to tell that it is a personal workbook. I am only interested in
regular workbooks.

EM

"Bob Phillips" wrote:

Be aware, this will count Personal.xls if there is one

--
HTH

Bob Phillips

"Hayeso" wrote in message
...
If workbooks.count0 then
end if

"ExcelMonkey" wrote:

how do you tell in VBA if there is workbook open in excel. That is,

when I
launch my xla, I want to check to see if there is at least one workbook

open.
If not, I will prompt user to open workbook and exit the xla.

Thanks








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
How to: Open closed workbook/Search data tables/Return data to open workbook Hugh Adams Excel Discussion (Misc queries) 0 August 18th 10 02:04 PM
Opening Excel, Book1 opens, remains open with other workbook open DanieB Excel Discussion (Misc queries) 0 September 3rd 09 08:23 AM
excel 2003 saved file will not open without a blank workbook open Bob Excel Discussion (Misc queries) 4 November 11th 06 04:24 PM
Excel workbook does not open in open window on desktop DeanH Excel Discussion (Misc queries) 2 March 8th 05 09:51 AM
Open a password protected excel workbook from second workbook to fetch data using dynamic connection kaustav choudhury Excel Programming 2 April 3rd 04 06:18 AM


All times are GMT +1. The time now is 12:18 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"