LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default Can DB connection retain throughout the Excel working session ?


Eric Fung wrote:
1. Does the Friend property safer in terms of security ?


I try to use the minimum scope possible e.g. if the connection isn't
required outside of the VBA project then don't expose it via a public
property/variable. Security isn't really a consideration here because
an Excel workbook's VBA project isn't secure enough to contain
sensitive information.

2. Although I see when the workbook is close, Office will help to

close the
connection for me.
I hope to be more discipline, to close the connection by myself
explicitly
However, I've tried to code at ThisWorkbook event - "BeforeClose"
and "Deactivate",
either event seems happen after Office already close the
connection for me.


I'd use the _BeforeClose event, with the extra code required to handle
the situation where the user cancels a save and therefore cancels the
close. Module level variables in the ThisWorkbook code module should
still be in scope (i.e. should not have been garbage-collected) when
the _BeforeClose and _Deactivate events fire, unless something has
happened to reset the VBA project e.g. hitting the reset button in the
Visual Basic Editor, adding controls to a worksheet, etc.

Jamie.

--



 
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
Startup and template locations in Citrix TS session and local session John Nurick Setting up and Configuration of Excel 2 September 21st 06 10:42 PM
msn stock updates quit working & no internet connection in excel K9CE Excel Discussion (Misc queries) 0 July 13th 06 04:36 PM
Data Connection wizard quits working SJR@mbci Excel Discussion (Misc queries) 0 June 22nd 05 03:59 PM
Wondering why the following ADO connection to Access isn't working... [email protected] Excel Programming 6 February 10th 05 08:55 AM
ADO Connection stopped working Tod Excel Programming 2 July 10th 04 05:25 AM


All times are GMT +1. The time now is 04:48 AM.

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

About Us

"It's about Microsoft Excel"