Bob Phillips wrote:
> If it is an event macro, use something like
>
> Dim iStartAs Long
>
> With ActiveWorkbook.VBProject.VBComponents("ThisWorkbook").CodeModule
> iStart = .CreateEventProc("BeforeSave", "Workbook") + 1
> .InsertLines iStart, _
> "Dim ans" & vbCrLf & _
> " ans = Msgbox( ""All OK"",vbYesNo)" & vbCrLf & _
> " If ans = vbNo Then Cancel = True"
> End With
>
> If it just another macro in Module1 say, then use
>
> Dim iNext As Long
>
> With ThisWorkbook.VBProject.VBComponents("Module1").CodeModule
> iNext = .CountOfLines + 1
> .InsertLines iNext, _
> "Sub myProc()" & vbNewLine & _
> " Msgbox ""Tesing new procedure"" " & vbNewLine & _
> "End Sub"
> End With
>
It works with simple macros. I'm using on another mashine some add-on
for Excel with special code to interact with another application. When
"parent" macro try to append another macro to VB Project, I'm getting
errors. It cannot compile unknown commands from add-on. Is it possible
to disable compilation for this part of code?
Thanks anyway!
Reg, VK
Bookmarks