LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
KR KR is offline
external usenet poster
 
Posts: 121
Default Newbie question, XL2003, VBA deleting/adding modules in multiple workbooks

I have hundreds of end-user workbooks that all have the same module on our
network. I just found out that there is an error in the module, and I've
created an updated module that fixes the problem and I need to replace it in
all of the workbooks without messing with the data or settings of those
workbooks.I've exported a copy of the fixed module onto our network so my
code can pull it into each of the other workbooks.

Based on code from Chip Pearson's site, I've grabbed what seems to be the
key lines to add to my code that loops through and finds all of the affected
workbooks. However, I haven't any experience working with VBA at this level,
and I'm not sure which part to tweak to grab an exported module instead of
creating one from scratch.

From Chip's site:

'this part will hopefully remove the old version of the module
Dim VBComp As VBComponent
Set VBComp = ThisWorkbook.VBProject.VBComponents("ValidateAndPa steData")
ThisWorkbook.VBProject.VBComponents.Remove VBComp

'How do I modify this to import my ValidateAndPasteData.bas file?
Set VBComp = ThisWorkbook.VBProject.VBComponents.Add(vbext_ct_S tdModule)
VBComp.Name = "NewModule"

'I'm thinking something like:
Set VBComp = ThisWorkbook.VBProject.VBComponents.Add(mypath &
"ValidateAndPasteData.bas")
'VBComp.Name = "NewModule"

but since this is a live environment and I don't have a good way to test
this before running it, I'm a little anxious to just do my usual
trial-and-error, because if the delete code works and the add code doesn't,
then I'll have broken all of the workbooks and angry coworkers...

Thanks for any help,
Keith


 
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
Newbie Question Column Adding Please Help Tom Grassi New Users to Excel 2 December 19th 05 07:00 PM
Newbie question: Importing modules (.bas) at startup? Joe Murphy[_4_] Excel Programming 4 June 22nd 04 03:00 AM
Newbie VBA Question; Deleting minimum value row Paul Edwards Excel Programming 2 April 18th 04 09:19 AM
Newbie question on deleting duplicate rows Phil Horwood Excel Programming 4 November 26th 03 10:38 PM
using forms and modules in multiple workbooks scrabtree23[_2_] Excel Programming 1 November 11th 03 10:57 PM


All times are GMT +1. The time now is 06:40 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"