excel - Comment vba code from another VBA CODE -
i comment lines contains msg box code vba. i'm trying library vba extensibility doesn't found solution.
any welcome.
this code:
sub commentcode() dim vbproj vbide.vbproject dim vbcomp vbide.vbcomponent dim codemod vbide.codemodule dim linenum long const quote = ' set vbproj = activeworkbook.vbproject set vbcomp = vbproj.vbcomponents("thisworkbook") set codemod = vbcomp.codemodule codemod linenum = .createeventproc("open", "workbook") linenum = linenum + 1 .insertlines linenum, quote end end sub
first, please change
const quote = '
to this:
const quote = "'"
basically quote (or rem
) string , needs enclosed in quotes.
as vb extensibilty, may need delete line once found, , insert new line comment @ beginning.