The following example uses the InsertLines method to insert a line, “Option Explicit,” in the specified code pane.
Application.VBE.CodePanes(1).CodeModule.InsertLines 1, "Option Explicit"