Bonjour à tous,
j'ai trouvé ce code pour copier un module lorsqu'on déplace une feuille excel qui semble intéressant cependant comme j'ai excel 2010, cela ne fonctionne pas !
code : " Sub ExportCodeMod() ' Dimension variables Dim strCode As String Dim vbCom As VBComponent Dim modObj As Object ' Set object to the module you want to export. Set modObj = _ Application.VBE.ActiveVBProject.VBComponents.Item("modTest") ' Place code in
a string. strCode = modObj.CodeModule.Lines(1, modObj.CodeModule.CountOfLines) ' Create new workbook. Application.Workbooks.Add ' Create a new module in workbook. Application.VBE.ActiveVBProject.VBComponents.Add (vbext_ct_StdModule) ' Add code to new module
from string variable. Application.VBE.ActiveVBProject.VBComponents.Item("Module1") _ .CodeModule.AddFromString (strCode) End Sub"
Excel 2010 ne reconnait pas la déclaration de variable as vbcomponent !!
Pourriez vous m'aider à convertir cette macro en vba 2010 ?
je vous en remercie d'avance.
Ncoutin