PC Review


Reply
Thread Tools Rate Thread

Database Workbook

 
 
ranswrt
Guest
Posts: n/a
 
      6th Aug 2008
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 With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      6th Aug 2008
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" <(E-Mail Removed)> wrote in message
news:F3D279F1-EC1F-4AD7-82AB-(E-Mail Removed)...
>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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use workbook is a database? =?Utf-8?B?Q0gsIExlb3c=?= Microsoft Excel Programming 2 23rd Sep 2006 12:24 PM
workbook database error? =?Utf-8?B?Um9k?= Microsoft Excel Crashes 0 23rd Feb 2006 07:57 PM
VLOOKUP in another workbook/Access database =?Utf-8?B?Q2hyaXMgQ2Fycg==?= Microsoft Excel Programming 4 3rd Aug 2005 06:14 PM
need to access a database in a excel workbook Greg Liber Microsoft Excel Worksheet Functions 5 13th Jan 2004 09:14 AM
Formatting a workbook for database import tehwa Microsoft Excel Programming 4 24th Dec 2003 08:16 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:04 PM.