vba - Get first real line from procedure using ProcBodyLine -
vba - Get first real line from procedure using ProcBodyLine -
i using procbodyline first line of procedure dynamically insert code @ run-time in procedure. code using same wrote in question
i facing issue procedures have definition in multiple lines using "_" separator:
this procedure before change:
and result after code inserted:
the documentation clear procbodyline: the first line of procedure line on sub, function, or property statement appears. not says on how statement ends.
when definition using 1 line, there no issue @ all. there way know real first code line (not definition) , next result?
vba not allow inline comments after continuation symbol, , line continuation symbol must have space before it, if procbodyline line ends space , _, continuation line. true if procedure has signature on single line ends comment , continuation symbol, because in case continuation of comment.
'i don't know why declaring codemodule vbide.codemodule causes type mismatch public function getfirstlineaftersignature(byval codemodule object, byval procname string, byval prockind vbide.vbext_prockind) long getfirstlineaftersignature = codemodule.procbodyline(procname, prockind) while right$(codemodule.lines(getfirstlineaftersignature, 1), 2) = " _" getfirstlineaftersignature = getfirstlineaftersignature + 1 loop getfirstlineaftersignature = getfirstlineaftersignature + 1 end function vba
Comments
Post a Comment