ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Coding to remove and import Module (https://www.excelbanter.com/excel-programming/397613-coding-remove-import-module.html)

[email protected]

Coding to remove and import Module
 
Hi!

I would like to remove a VB module and import an other one each time I
open my excel file. Thus I need the code to put in my Sub Auto_Open()
to remove and import a module.

I just hope these codes exist!


Chip Pearson

Coding to remove and import Module
 
Try something like

Sub Auto_Open()
On Error Resume Next
With ThisWorkbook.VBProject.VBComponents
.Remove .Item("modToReplace")
.Import Filename:="C:\Test\modToReplace.bas"
End With
End Sub

See www.cpearson.com/Excel/VBE.aspx for much more information about working
with the objects in the VBA Editor.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)


wrote in message
ups.com...
Hi!

I would like to remove a VB module and import an other one each time I
open my excel file. Thus I need the code to put in my Sub Auto_Open()
to remove and import a module.

I just hope these codes exist!



[email protected]

Coding to remove and import Module
 
Excellent! Works great! Thanks!

Now I have text in a Notepad document and I would like it to be copied
in a cell once the module is copied. Which code can I use to do this?



All times are GMT +1. The time now is 05:12 PM.

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