PC Review


Reply
Thread Tools Rate Thread

Close workboook if it is open

 
 
=?Utf-8?B?QXJuZSBIZWdlZm9ycw==?=
Guest
Posts: n/a
 
      15th Nov 2007
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 With Quote
 
 
 
 
=?Utf-8?B?UGF1bFc=?=
Guest
Posts: n/a
 
      15th Nov 2007
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!

 
Reply With Quote
 
Frederik
Guest
Posts: n/a
 
      15th Nov 2007
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" <(E-Mail Removed)> schreef in bericht
news:FC95413D-660A-466F-BF3F-(E-Mail Removed)...
> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open a new DB and close the close the original DB PJFry Microsoft Access Form Coding 2 26th Feb 2009 12:05 AM
How do I make Word stay open when I close my one open document? lauren38 Microsoft Word Document Management 2 10th Dec 2008 03:36 PM
Dialog Box is open Click Ok then close open diallog boxes word 2 gadget268 Microsoft Word Document Management 4 24th Oct 2008 12:45 PM
stop calculation on workboook open =?Utf-8?B?RGF2aWQ=?= Microsoft Excel Programming 2 25th Nov 2004 01:59 PM
Excel-Can't close 1 open Workbook without closing other open Workb =?Utf-8?B?ZnJhbWluZ2hhbQ==?= Microsoft Excel Misc 1 18th Oct 2004 08:59 PM


Features
 

Advertising
 

Newsgroups
 


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