try this
Sub sMakeMacroCode _
(ByVal wbBoek As Excel.Workbook, ByVal wsSheet As Excel.Worksheet , ByVal
sObject As String, ByVal sAction As String, ByVal sCode As String)
'Ex:sMakeMacroC ode(objWB, "Blad1", "Worksheet" , "Activate", Chr(9) &
"ActiveSheet.En ableAutoFilter = True")
Dim StartLine As Long, X As Byte
'wbBoek.Applica tion.Visible = True
Try
With wbBoek.VBProjec t.VBComponents. Item(wsSheet.In dex + 1).CodeModule
StartLine = .CreateEventPro c(sAction, sObject) + 1
..InsertLines(S tartLine, sCode)
X = wbBoek.VBProjec t.Protection
wbBoek.Applicat ion.VBE.MainWin dow.Visible = False
'Close is beter than visible but won't work
End With
Catch ex As Exception
MsgBox("Fout: " & ex.Message)
End Try
End Sub 'sMakeMacroCode
its add some code to an workbook on the level worksheet
in excell 2002 or higher you need to allow editing the VBE
google on VBProject.VBCom ponents will find mmore info
Jan
"Paul Clement" <Us************ ***********@sws pectrum.com> schreef in bericht
news:g0******** *************** *********@4ax.c om...
On Tue, 13 Sep 2005 13:12:47 +0200, "Lars Netzel" <ui****@adf.s e> wrote:
¤ Can you alter them or remove them?
¤
¤ /Lars
Since this involves automation, you might post this question in
microsoft.publi c.excel.program ming.
I'm afraid I don't know of a way to modify the code modules
programmaticall y.
Paul
~~~~
Microsoft MVP (Visual Basic)