Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to make opening of workbook conditional of opening of another workbook

I have a main workbook named Homebase that has a password form. The
correct password must be entered to open the Homebase workbook.
Homebase has hyperlinks to module workbooks which have different names
(P&L Module, Cash Flow Module, etc.)

I want to make sure that users cannot open module workbooks unless the
Homebase workbook is already open.
If someone tried to do this a message box would appear that displays
the mesage: "Sorry, but you can only access this module through
Homebase." The module workbook would NOT open and Excel would be blank
when the user closes the message box.

Would appreciate any help with the VBA code that I would write in each
module workbook to do the above.


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default How to make opening of workbook conditional of opening of another workbook

Just off the top of my head I can think of two ways, but
neither are 100% secure, it depends on what level of
protection you want. One would be hide all worksheets in
the module in xlveryhidden mode. Then on the workbook
open event have it look to see if workbook (whatever you
name the main book) is open if so unhide sheets, if not
close workbook. This would mean the main workbook would
always have to keep the same name. (or user could just
name a workbook that name and trick it) The other would
be to write to a hidden text file when it is open and
then when it closes delete the file. Then the other
workbook look for that when it opens. neither way is
perfect but they can be modified to suit your needs.

Keith
www.kjtfs.com
-----Original Message-----
I have a main workbook named Homebase that has a

password form. The
correct password must be entered to open the Homebase

workbook.
Homebase has hyperlinks to module workbooks which have

different names
(P&L Module, Cash Flow Module, etc.)

I want to make sure that users cannot open module

workbooks unless the
Homebase workbook is already open.
If someone tried to do this a message box would appear

that displays
the mesage: "Sorry, but you can only access this module

through
Homebase." The module workbook would NOT open and Excel

would be blank
when the user closes the message box.

Would appreciate any help with the VBA code that I would

write in each
module workbook to do the above.


---
Message posted from http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to make opening of workbook conditional of opening of another workbook

Would you happen to know what the VBA code would be and where I would
place it?

I used the following code and cannot get it to work:

Sub Workbook_Open()

If Workbooks.Open("Home") = False Then

ThisWorkbook.Close

End If

End Sub

I placed the above code in ThisWorkbook.


---
Message posted from http://www.ExcelForum.com/

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
How do I stop blank workbook from opening when opening an existing kjg Excel Discussion (Misc queries) 3 February 12th 10 09:36 PM
when opening an Excel Workbook, another blank workbook also opens Gord Dibben Excel Discussion (Misc queries) 0 October 12th 07 09:49 PM
when opening an Excel Workbook, another blank workbook also opens spmu Excel Discussion (Misc queries) 0 October 12th 07 01:46 PM
Conditional Formatting Using If Statement On Opening Of Workbook Bill Foley Excel Worksheet Functions 11 October 19th 05 11:18 PM
Question for Experts: Opening workbook with workbook references Chris Excel Programming 0 September 11th 03 07:05 PM


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