Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Close workboook if it is open

Hi! I want to check if a workbook is open. If it is open I want to close it.
The probelm is that if I want to check if it is open and it is not the code
cannot find the sheet at all and thus produces an error. Is there any way I
can check if it is open without getting an error? thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Close workboook if it is open

I use

Windows(cl).close savechanges = False

where cl is the workbook I want to close, I usually have an "On error resume
next" so that if the workbook isn't there it won't error when it can't close.

"Arne Hegefors" wrote:

Hi! I want to check if a workbook is open. If it is open I want to close it.
The probelm is that if I want to check if it is open and it is not the code
cannot find the sheet at all and thus produces an error. Is there any way I
can check if it is open without getting an error? thanks!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Close workboook if it is open

Hello Arne

Have a look at

http://www.j-walk.com/ss/excel/tips/tip54.htm

Walkenbach gives interesting tips on his site!!!

greetings


"Arne Hegefors" schreef in bericht
...
Hi! I want to check if a workbook is open. If it is open I want to close
it.
The probelm is that if I want to check if it is open and it is not the
code
cannot find the sheet at all and thus produces an error. Is there any way
I
can check if it is open without getting an error? 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
Slow to open /close George Gee New Users to Excel 3 May 8th 05 10:29 PM
stop calculation on workboook open David Excel Programming 2 November 25th 04 01:59 PM
if its open...close it choice[_2_] Excel Programming 10 August 16th 04 01:19 PM
Open then Close Markus Excel Programming 2 July 14th 04 07:44 PM
On Open/On Close Jeff Excel Programming 3 June 9th 04 10:23 PM


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