Workbook Open event

G

Guest

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
 
T

Tom Ogilvy

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top