View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Import "ThisWorkbook"?

The ThisWorkbook class module can't be imported/deleted.

But you can add procedures into it.

Check Chip Pearson's site:
http://www.cpearson.com/excel/vbe.aspx
look for: Creating An Event Procedure

==========
Another option that may be easier if you're creating a new workbook...

Create a template file (*.xlt). Put all the code you need in that template's
project--including all the events you want in the ThisWorkbook module.

Then use that file as the template for the new workbook.

Dim NewWkbk as workbook
set newwkbk = workbooks.add(Template:="C:\yourpath\myfile.xlt")



"Charlotte E." wrote:

When I right-click and export the "ThisWorkbook" class module everything
works fine :-)

But when I try to import it again it gets imported a a new seperate
class-module with the name "ThisWorkbook1".

How to directly import the "ThisWorkbook" into the original/true
"ThisWorkbook" class-module, without having to copy and paste the imported
code?


--

Dave Peterson