Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default modifying code using addfromfile method

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
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
modifying formulas with code Rick B[_6_] Excel Programming 3 January 28th 04 02:03 PM
Modifying formulas through code Rick B[_6_] Excel Programming 1 January 23rd 04 11:24 PM
Need Help Modifying Code JStone0218 Excel Programming 2 January 19th 04 10:27 AM
Help modifying code BruceJ[_2_] Excel Programming 1 December 10th 03 12:52 AM
Modifying Code that deletes a Row Todd Huttenstine[_2_] Excel Programming 2 November 27th 03 10:41 PM


All times are GMT +1. The time now is 07:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"