Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Import "ThisWorkbook"?

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?




  #2   Report Post  
Posted to microsoft.public.excel.programming
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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Import "ThisWorkbook"?

You have to remove the original first, otherwise you get the situation that
you describe.

--
__________________________________
HTH

Bob

"Charlotte E." wrote in message
...
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?






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Import "ThisWorkbook"?

oops sorry, I only caught the class bit, missed THisWorkbook.

--
__________________________________
HTH

Bob

"Bob Phillips" wrote in message
...
You have to remove the original first, otherwise you get the situation
that you describe.

--
__________________________________
HTH

Bob

"Charlotte E." wrote in message
...
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?








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
Programatically adding macro to Excel - "ThisWorkbook" Aerojade Excel Discussion (Misc queries) 3 October 1st 08 12:53 PM
Import data "Hangs", A "time out" is needed. Help! :) John37309 Excel Programming 5 July 23rd 07 10:54 AM
Can I disable a macro in "Thisworkbook" with true or false? Husker87 Excel Programming 7 February 17th 06 02:15 AM
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 06:15 PM.

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"