Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This is the routine which swaps the code:
Sub MSmodMender() 'replaces code in a module with code from a text file For Each i In Application.VBE.VBProjects("VBAMidasWrkShtProj").V BComponents If i.codemodule.Name = "UpdatePhaseMod" Then 'need to name the module to be replaced i.codemodule.DeleteLines 1, i.codemodule.CountOfLines 'delete all lines in the module i.codemodule.AddFromFile "cape cod:fmidas:closet:back shelf:UpdatePhases03042005.txt" 'need to name the text file Exit Sub End If Next End Sub It works fine on the first workbook I loop to, but on all subsequent loops only the DeleteLines method statement works. The statement with AddfromFile method does nothing, not even an error. Thanks for any help you can offer. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
modifying formulas with code | Excel Programming | |||
Modifying formulas through code | Excel Programming | |||
Need Help Modifying Code | Excel Programming | |||
Help modifying code | Excel Programming | |||
Modifying Code that deletes a Row | Excel Programming |