View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Workbook Open event

Why not take out the workbook_Open event in Book2 and have all the code you
need to run in Book1 with proper references so it works on the right book.

then have book1 open book2 and process it, then close itself.

--
Regards,
Tom Ogilvy


"Libby" wrote in message
...
Hi

I have two workbooks called Book1 and Book2

Book2 has a password to open and is readonly

When I open Book1 from Book2, the Workbook_Open event in Book2 doesn't

run,
or it runs but doesn't have any effect, even if I step through it. No

error
messages appear, it just doesn't work.

The code is as follows
'Book1
Sub Workbook_Open
Workbooks.Open "path to book2",,,open password
ThisWorkbook.close
end sub

'Book2
Sub Workbook_Open
msgbox ok
Call ShowSheets 'macro stored in Module1 which
'unhides hidden sheets
sheet3.name = "Success"
end sub

The reason I want to open one workbook from another like this is because
unless the main workbook, Book2, is password to open, it can be opened in
Word and all the veryhidden sheets viewed. Hence I password to open Book2

and
use another Workbook that doesn't contain any hidden sheets to open it.

I'm using xl97
Thanks in advance