Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JYH JYH is offline
external usenet poster
 
Posts: 4
Default How to import events VBA code in Excel?

Good day everyone,

I have a small fleet of Excel apps who, sometime, need updating.
For modules, I simply
ThisWorkbook.VBProject.VBComponents("WhateverModul e").Export
tempFile
DestWbk.VBProject.VBComponents.Import tempFile
Kill (tempFile)

But I can not use the same code to import into ThisWorkbook as I do
for modules.
ThisWorkbook.VBProject.VBComponents("ThisWorkbook" ).Export
tempFile
DestWbk.VBProject.VBComponents.Import tempFile
Kill (tempFile)

Instead of replacing (or adding) the code within ThisWorkbook, it
creates a new Class Modules named "ThisWorkbook1".

Do you have any suggestion on how could I fix that?

The only other solution is to manually set all my events to something
static refering to a module.

Thank you

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default How to import events VBA code in Excel?

Hello,

Look at Chip Pearson's site:

http://www.cpearson.com/excel/vbe.aspx

The section "Copy A Module From One Project To Another" should solve
your problem.

Regards,
Per

On 23 Sep., 20:37, JYH wrote:
Good day everyone,

I have a small fleet of Excel apps who, sometime, need updating.
For modules, I simply
* * ThisWorkbook.VBProject.VBComponents("WhateverModul e").Export
tempFile
* * DestWbk.VBProject.VBComponents.Import tempFile
* * Kill (tempFile)

But I can not use the same code to import into ThisWorkbook as I do
for modules.
* * ThisWorkbook.VBProject.VBComponents("ThisWorkbook" ).Export
tempFile
* * DestWbk.VBProject.VBComponents.Import tempFile
* * Kill (tempFile)

Instead of replacing (or adding) the code within ThisWorkbook, it
creates a new Class Modules named "ThisWorkbook1".

Do you have any suggestion on how could I fix that?

The only other solution is to manually set all my events to something
static refering to a module.

Thank you


  #3   Report Post  
Posted to microsoft.public.excel.programming
JYH JYH is offline
external usenet poster
 
Posts: 4
Default How to import events VBA code in Excel?

Thank you very much.

I am not sure why my code wasn't working but I'll use his code until I
can figure out why.

Thank you again very much
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
Can I import raw HTML source code into Excel? J Diorio Excel Programming 5 July 11th 08 06:37 AM
import xml in excel workbok using VBA code born2achieve Excel Programming 1 January 8th 08 02:52 AM
Code to import from txt to excel N.F[_2_] Excel Discussion (Misc queries) 2 August 7th 07 08:24 PM
Import HTML code into Excel josuegm Excel Programming 2 May 30th 06 11:02 PM
Code: Using Excel Application level Events Chris W[_3_] Excel Programming 0 February 27th 05 07:40 PM


All times are GMT +1. The time now is 05:19 AM.

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"