Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default VBA code to check if another window is open?

I need to check if another window is open - if not I am going to display a
dialog box letting them know to open the file (or possibly opening a browse
window for them to open it), and if so, just keep going
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default VBA code to check if another window is open?

Just to confrim you want to know if another file is open? If it is not open
then why not just open it yourself, something like this...

dim wbk as workbook

on error resume next
set wbk = workbooks("MyBook.xls")
on error goto 0
is wbk is nothing then _
set wbk = workbooks.open("Mybook.xls")

--
HTH...

Jim Thomlinson


"jweasl" wrote:

I need to check if another window is open - if not I am going to display a
dialog box letting them know to open the file (or possibly opening a browse
window for them to open it), and if so, just keep going

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default VBA code to check if another window is open?

Ok, I tried modifying the code to give a msgbox saying "Open Quote System" if
the window is not found - but it says that if the window is found or not.
I guess I'm not sure of the exact wbk property - the file is a template
(Quote System.xlt), when opened the default is Quote System1 - but I set wbk
to Quote System1 and Quote System1.xls, it didn't work either time.

"Jim Thomlinson" wrote:

Just to confrim you want to know if another file is open? If it is not open
then why not just open it yourself, something like this...

dim wbk as workbook

on error resume next
set wbk = workbooks("MyBook.xls")
on error goto 0
is wbk is nothing then _
set wbk = workbooks.open("Mybook.xls")

--
HTH...

Jim Thomlinson


"jweasl" wrote:

I need to check if another window is open - if not I am going to display a
dialog box letting them know to open the file (or possibly opening a browse
window for them to open it), and if so, just keep going

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default VBA code to check if another window is open?

This code doesn't work either

If Windows("Quote System1").Visible = True Then MsgBox "Visible" _
Else MsgBox "Not Visible"

If the window is open, it will give a msgbox saying "Visible", but if it's
not open it gives me an error - Subscript out of range.


"jweasl" wrote:

Ok, I tried modifying the code to give a msgbox saying "Open Quote System" if
the window is not found - but it says that if the window is found or not.
I guess I'm not sure of the exact wbk property - the file is a template
(Quote System.xlt), when opened the default is Quote System1 - but I set wbk
to Quote System1 and Quote System1.xls, it didn't work either time.

"Jim Thomlinson" wrote:

Just to confrim you want to know if another file is open? If it is not open
then why not just open it yourself, something like this...

dim wbk as workbook

on error resume next
set wbk = workbooks("MyBook.xls")
on error goto 0
is wbk is nothing then _
set wbk = workbooks.open("Mybook.xls")

--
HTH...

Jim Thomlinson


"jweasl" wrote:

I need to check if another window is open - if not I am going to display a
dialog box letting them know to open the file (or possibly opening a browse
window for them to open it), and if so, just keep going

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 I can I open a small window within window Loz Excel Discussion (Misc queries) 0 May 20th 07 09:04 PM
VBA line of code executes in Immediate Window but not in Code Window [email protected] Excel Discussion (Misc queries) 2 April 30th 07 02:52 PM
Docking Project Explorer, Properties window and Code window in VBE jayray Setting up and Configuration of Excel 2 March 27th 07 04:42 PM
Can't open VBA-Code Window Christoph Dümmen Excel Programming 5 January 7th 06 04:07 PM
VB code to open Print window OscarC Excel Programming 4 December 6th 04 11:18 PM


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