Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Does anyone know a fast way to replace a VBA string IN a VBA module by using VBA code? So I'm not talking about replacing strings in worksheets... Suppose that I have workbook A with the following sub in a codemodule: -Sub Example() MsgBox "Just an example.", vbOKOnly End Sub- So now I want to use VBA code in workbook B to change the string "Example" in the codemulde of A to "ShowMessage", so that the new sub in A will be: -Sub ShowMessage() MsgBox "Just an example.", vbOKOnly End Sub- Macro security settings aside, I know you need a reference to the MS VBA Extensibilty, but my problem is the following. The object "codemodule" has no method "replace". So these are valid codelines: -Workbooks("A.xls").VBProject.VBComponents(1).CodeM odule.Find Workbooks("A.xls").VBProject.VBComponents(1).CodeM odule.ReplaceLine- but: -Workbooks("A.xls").VBProject.VBComponents(1).CodeM odule.Replace- doesn't exist... All suggestions are welcome. Thanks in advance. shoba -- shoba ------------------------------------------------------------------------ shoba's Profile: http://www.excelforum.com/member.php...o&userid=24676 View this thread: http://www.excelforum.com/showthread...hreadid=382617 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
question about excessive code in replacing #N/A when using VLOOKUP | Excel Discussion (Misc queries) | |||
Convert text strings to a code or number | Excel Worksheet Functions | |||
Replacing hard code with reference to a cell value | Excel Programming | |||
Replacing code at runtime | Excel Programming | |||
Replacing code at runtime | Excel Programming |