ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Project Code (https://www.excelbanter.com/excel-programming/437491-vba-project-code.html)

fi.or.jp.de

VBA Project Code
 
Hi All,

I have excel based tracker. All the macro part working fine.

Problem is I sent the file to all the users.

Small mistake I made in Macro part ie.,

instead of Uform.optionbutton1 = true I put that one as
Uform.optionbuttion2 = true.

I need to change only one line code in the module.

I can send new excel file ? but I am learning how to change the module
codes using macro.

Any suggestions ?

FS[_2_]

VBA Project Code
 
Hi,

Try this code :

'==================
Sub test()
''''''''for example
Wbk$ = "MEFC_Dates.xla"
ModName$ = "usfParams"
Before$ = "Unload usfParams"
After$ = "Unload me"
'''''''''''''''''
ChangeCodeVBA Wbk, ModName, Before, After
End Sub

Sub ChangeCodeVBA(WbkName, ModuleName, BeforeChange, AfterChange)
Dim S$
With Workbooks(WbkName).VBProject.VBComponents(ModuleNa me).CodeModule
On Error Resume Next
S = .Lines(1, .CountOfLines)
.DeleteLines 1, .CountOfLines
On Error GoTo 0
S = Join(Split(S, BeforeChange), AfterChange)
.AddFromString S
End With
Workbooks(WbkName).Save
End Sub 'fs
'==================

FS
--
Frédéric SIGONNEAU
Modules et modèles pour Excel :
http://frederic.sigonneau.free.fr/

fi.or.jp.de a écrit :
Hi All,

I have excel based tracker. All the macro part working fine.

Problem is I sent the file to all the users.

Small mistake I made in Macro part ie.,

instead of Uform.optionbutton1 = true I put that one as
Uform.optionbuttion2 = true.

I need to change only one line code in the module.

I can send new excel file ? but I am learning how to change the module
codes using macro.

Any suggestions ?



All times are GMT +1. The time now is 01:42 PM.

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