Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Test to see if a spreadsheet window is open

Dear all,

Part of my macro calls a cell value on one sheet to switch between open
windows. If the value is not typed in correctly on the first sheet then
the macro gives the error "subscript out of range", and is unable to
open the other sheet.

How can I put a test in my macro to check to see if an error will be
produced when the line is run?

I tried (amongst others):

If IsError(windows(sheetname).activate) then etc.


Any help would be greatly appretiated.

Tom


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Test to see if a spreadsheet window is open

Hi,

first loop throug all your windows with something like
Sub test()
For Each myWindow In Application.Windows
If myWindow.Caption = "test.xls" Then
found = True
End If
Next

If found = True Then
'...do something
Else
'... show an error message
End If
End Sub

regards

arno


"lopsided" schrieb im Newsbeitrag
...
Dear all,

Part of my macro calls a cell value on one sheet to switch between open
windows. If the value is not typed in correctly on the first sheet then
the macro gives the error "subscript out of range", and is unable to
open the other sheet.

How can I put a test in my macro to check to see if an error will be
produced when the line is run?

I tried (amongst others):

If IsError(windows(sheetname).activate) then etc.


Any help would be greatly appretiated.

Tom


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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Test to see if a spreadsheet window is open

That worked perfectly
Thanks a lot!

Tom


---
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
how do i open a new window when opening a spreadsheet Michael K Excel Discussion (Misc queries) 1 June 12th 08 11:54 PM
How I can I open a small window within window Loz Excel Discussion (Misc queries) 0 May 20th 07 09:04 PM
Force linked spreadsheet to open in fullsized window? Patricia D Excel Discussion (Misc queries) 2 July 27th 06 04:56 AM
Can you open a new spreadsheet in a new program window? 3R''s Excel Discussion (Misc queries) 3 November 10th 05 12:59 AM
How do I force a hyperlink in a spreadsheet to open a new window? sq246 Excel Worksheet Functions 0 November 18th 04 10:53 PM


All times are GMT +1. The time now is 11:06 PM.

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"