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: 7
Default Check if a document is open

Hi,

I have a lot of Excel (Microsoft office XP) files that are all linked to a
main source document. I need to open that source document each time I open
one of the files so they can update. I hide the source document when it
opens. I have a functional code in VBA, but I am not the real user of the
documents and I need it to be more user-friendly. I need to prevent the
alerts asking if I want to re-open the the source document each time and
warning that any unsaved information will be discarded. I always click "no"
because I never want to reopen the source document if it is already open, and
then it gives an error '1004' and asks to end or debug.

Is there a way to check if the source document is already open and take no
action if it is, but then if it is not already open, open it?

Here is the code:

'In the "This Workbook" object of each VBA Project

Private Sub Workbook_Open()

Application.ScreenUpdating = False
'Opening the main document:
Workbooks.Open "Workbook.xls"
'Hiding it:
ActiveWindow.Visible = False
Application.ScreenUpdating = True
End Sub


Can someone help me out?

Thanks
--
AnthonyJ
 
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
Spell Check on Excel document Michele Excel Discussion (Misc queries) 2 February 9th 10 08:30 PM
how do i check if i have printed a document in excel and when petergod New Users to Excel 0 December 4th 09 05:09 PM
I forgot my password to open an excel document, how do I open it? chris ohearn Excel Discussion (Misc queries) 1 August 11th 08 02:32 PM
my excel document won't open unless i go file, then open EB500 Excel Discussion (Misc queries) 1 June 3rd 05 06:42 PM
spell check protected document Sportingspaniel Excel Discussion (Misc queries) 1 January 10th 05 11:40 AM


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