Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default What type of code do you put in "ThisWorkBook"???

I assume any public code that is common to the entire workbook. Isn't
"ThisWorkBook" just the same as a user-added module?

Please set me straight on the use of "ThisWorkBook" vs Modules.

Thanks,

Hexman

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default What type of code do you put in "ThisWorkBook"???

ThisWorkbook is a class module, specific to workbook events, such as
Workbook_Open. There are also worksheet class modules, where worksheet
events are invoked. Code in these modules is usually not accessible from
other modules, neither other class modules nor standard code modules.

Unlike standard code modules, which have to be explicitly added to a
workbook, these class modules automatically get created when a workbook is
created, and when sheets are created.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Hexman" wrote in message
...
I assume any public code that is common to the entire workbook. Isn't
"ThisWorkBook" just the same as a user-added module?

Please set me straight on the use of "ThisWorkBook" vs Modules.

Thanks,

Hexman



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default What type of code do you put in "ThisWorkBook"???

On Thu, 22 Dec 2005 00:50:30 -0000, "Bob Phillips"
wrote:

ThisWorkbook is a class module, specific to workbook events, such as
Workbook_Open. There are also worksheet class modules, where worksheet
events are invoked. Code in these modules is usually not accessible from
other modules, neither other class modules nor standard code modules.

Unlike standard code modules, which have to be explicitly added to a
workbook, these class modules automatically get created when a workbook is
created, and when sheets are created.


Thanks for the explanation.

Hexman
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default What type of code do you put in "ThisWorkBook"???


"Hexman" wrote in message
...
I assume any public code that is common to the entire workbook. Isn't
"ThisWorkBook" just the same as a user-added module?

Please set me straight on the use of "ThisWorkBook" vs Modules.

Thanks,

Hexman


The ThisWorkbook code module is a good place to put menu creation and
deletion code and variable initiation code. If you put code like this in
the ThisWorkbook code module for your PERSONAL.XLS file, you can load all
sorts of customizations and menus when the app starts. The only two events
in this module that I currently utilize are the Workbook_Open event the
Workbook_Close event.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default What type of code do you put in "ThisWorkBook"???

On Wed, 21 Dec 2005 19:46:39 -0600, "42N83W"
wrote:


"Hexman" wrote in message
.. .
I assume any public code that is common to the entire workbook. Isn't
"ThisWorkBook" just the same as a user-added module?

Please set me straight on the use of "ThisWorkBook" vs Modules.

Thanks,

Hexman


The ThisWorkbook code module is a good place to put menu creation and
deletion code and variable initiation code. If you put code like this in
the ThisWorkbook code module for your PERSONAL.XLS file, you can load all
sorts of customizations and menus when the app starts. The only two events
in this module that I currently utilize are the Workbook_Open event the
Workbook_Close event.

Thanks,

Hexman
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 type "itis" without Excel putting a space "it is"? Max Excel Worksheet Functions 4 March 18th 07 10:22 PM
Where is the toolbar with the "bold type", "font type", options fwccbcc New Users to Excel 2 May 3rd 06 09:11 PM
How to use VBA to copy this code to "thisworkbook" objects of all opened workbooks ? Amolin[_2_] Excel Programming 5 June 3rd 05 08:34 AM


All times are GMT +1. The time now is 05:21 PM.

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"