Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 151
Default Workbook Open event

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
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
Workbook open event Pawan Excel Worksheet Functions 7 August 26th 08 07:32 AM
Event: open workbook Jeff Excel Discussion (Misc queries) 1 September 28th 06 02:58 PM
Workbook open event G Lam Excel Programming 3 November 12th 04 04:38 PM
Workbook Open event Todd Huttenstine Excel Programming 1 April 21st 04 07:06 PM
Workbook Open Event Dave Peterson[_3_] Excel Programming 0 October 17th 03 02:38 AM


All times are GMT +1. The time now is 03:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"