Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 23rd, 2008, 06:36 PM
Authorized User
 
Join Date: Apr 2007
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default Vba Vbe Export

Does anyone know how to remove the entire vba project (vbe) from one workbook?

Then, load it into another workbook on its workbook open event?

Thanks for any help you could give me.

Coby.



 
Old January 23rd, 2008, 10:43 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

You can try to Export the Components and then Import it to another workbook

Here is the hint

Code:
Sub VBE_Pjt()

Dim VBPjt As VBProject
Dim oWB As Workbook
Dim oVBC As VBComponent
Set oWB = Workbooks("MyExample.XLS")
Set VBPjt = oWB.VBProject
For Each oVBC In VBPjt.VBComponents
    oVBC.Export "c:\mytemp\" & oVBC.Name
Next oVBC
'' Loop for all the files
VBPjt.VBComponents.Import "c:\mytemp\mlinkfix"

End Sub
You need to add reference to Visual Basic Extensibility for executing the above code.

Also try VBPjt.SaveAs if it works for you

Cheers
Shasur

http://www.dotnetdud.blogspot.com

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old January 25th, 2008, 04:40 PM
Authorized User
 
Join Date: Apr 2007
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, That approach will work for what I am doing!







Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Microsoft VBE LaxNasty Word VBA 2 December 29th, 2006 02:44 AM
VBE Add-ins crmpicco Excel VBA 0 May 11th, 2005 06:59 AM
File Export in VBA desprate Access VBA 3 April 24th, 2005 01:48 AM
Stop VBE Window Showing Skunk Excel VBA 0 December 31st, 2004 05:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.