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

I have a Database workbook that is opened by other workbooks to access the
data in it. Is it possible to make the database workbook so that it can only
be opened thru antoher workbook and not by clicking on the icon?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Database Workbook

You can do this with the Auto_Open procedure in the data base workbook.

Sub Auto_Open()
MsgBox "This workbook cannot be opened manually"
ThisWorkbook.Close savechanges:=False
End Sub

Auto_Open is automatically executed when the workbook is opened manually,
not when it is opened via VBA code and so the code above closes the workbook
if it is opened manually. Of course, the user could defeat this by disabling
VBA code or by simply holding the SHIFT key down while opening the workbook.
However, this approach may be "good enough" for your purposes.

If you need code to run when the workbook is opened, either via VBA code and
manually, put that code in the Workbook_Open event in the ThisWorkbook
module. Workbook_Open is executed when the workbook is opened, regardless of
how it is opened.

--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



"ranswrt" wrote in message
...
I have a Database workbook that is opened by other workbooks to access the
data in it. Is it possible to make the database workbook so that it can
only
be opened thru antoher workbook and not by clicking on the icon?


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
include access database in excel workbook mono Excel Programming 7 October 8th 07 04:21 PM
How to use workbook is a database? CH, Leow Excel Programming 2 September 23rd 06 12:24 PM
Creating an Excel Database in Separate Workbook Brian C Excel Programming 17 February 16th 06 10:17 PM
VLOOKUP in another workbook/Access database Chris Carr Excel Programming 4 August 3rd 05 06:14 PM
Formatting a workbook for database import tehwa Excel Programming 4 December 24th 03 08:16 AM


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