ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Import "ThisWorkbook"? (https://www.excelbanter.com/excel-programming/416880-import-thisworkbook.html)

Charlotte E.

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?





Dave Peterson

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

Bob Phillips[_3_]

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?







Bob Phillips[_3_]

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?










All times are GMT +1. The time now is 03:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com