Retreive Line3

Visvang
07-13-2010, 09:55 AM
i have a module1

Public sub 123()
activeworkbook.save
mod3.321
end sub

now i want the make a new module (module2) and get the value of line3/4 of module1, beacause i want to change the lines based on what they are, basicly i just want to change line3/4 to

'activeworkbook.save
'mod3.321
or to

activeworkbook.save
mod3.321
is there a way to get that value or not

iabbott
07-14-2010, 02:28 AM
you want the value of a variable?

declare the variable as public at the top of the module, before the sub and it will be available for any procedure in that project

Visvang
07-14-2010, 04:52 AM
Thanks but i mange

Public Sub RemoveSave_Once()

Dim VBProj As VBIDE.VBProject
Dim VBComp As VBIDE.VBComponent
Dim CodeMod As VBIDE.CodeModule
Dim ProcName As String
Dim MyCode As Boolean

Set VBProj = ActiveWorkbook.VBProject
Set VBComp = VBProj.VBComponents("ModSaveHour")
Set CodeMod = VBComp.CodeModule

ProcName = "DeleteThisProc"
With CodeMod
MyCode = .Find("'ActiveWorkbook.Save", 3, 1, 3, 21, True, False)
If MyCode = True Then
.DeleteLines 3, 1
.InsertLines 3, "ActiveWorkbook.Save"
Else
.DeleteLines 3, 1
.InsertLines 3, "'ActiveWorkbook.Save"
End If
End With

End Sub

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum