LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Check if workbook open (Not working)

Hi,

My program starts with a simple form to create a new workbook or open an
existing one. Once you do either, the form disappears and either opens or
starts an new workbook. Once you close either the newly created workbook or
the existing one, the form re-appears asking you the same question of
creating a new workbook and/or opening an existing one. If the user selects
to open an existing workbook and that workbook is the name of the previous
workbook he/she has opened prior, in actuality the workbook may very well
already be open but not active or visible. My code below checks if the
workbook is already opened and if so, closes it and re-opens it.

Problem:
If the workbook is open the code will close it and the program will go dead
stopping after (Workbooks(StrWkBk).Close savechanges:=False). Is there a way
to force the program/script to continue?



On Error resume next
ThisWorkbook.Activate
Workbooks(StrWkBk).Close savechanges:=False

Set wbResults1 = Workbooks.Open(StrName)
--
PK
 
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
VBA to check is someone else has a workbook open Jim K.[_2_] Excel Discussion (Misc queries) 2 August 29th 08 04:32 PM
Check for open workbook Oldjay Excel Programming 3 April 17th 08 11:09 AM
Check if workbook is already open... Cumberland[_9_] Excel Programming 1 August 22nd 06 09:16 AM
Check if workbook open dkipping Excel Discussion (Misc queries) 4 May 24th 06 02:00 PM
Check for open workbook georgio Excel Programming 2 November 20th 04 11:03 PM


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