Here is the result of some procrastination:
Code:
Sub ImportCode()
Dim xlApp As Object, fso As Object, tstream As Object
Dim nStart As Integer, nEnd As Integer, nLine As Integer
Dim strLine As String
Set xlApp = CreateObject("Excel.Application")
strFile = xlApp.GetOpenFilename("C/C++ Source Files (*.c; *.cpp),*.c;*.cpp")
xlApp.Quit
If (strFile = False) Then Exit Sub
nStart = CInt(InputBox("Please enter the start line.", "Start", 0))
nEnd = CInt(InputBox("Please enter the end line.", "End", 999))
Set fso = CreateObject("Scripting.FileSystemObject")
Set tstream = fso.OpenTextFile(strFile)
While (Not tstream.AtEndOfStream)
strLine = tstream.ReadLine
If (nLine >= nStart And nLine <= nEnd) Then
Selection.Font.Color = wdColorBlueGray
Selection.TypeText Format(nLine, "#000")
Selection.Font.Color = wdColorAutomatic
Selection.TypeText " " & strLine & vbCrLf
End If
nLine = nLine + 1
Wend
End Sub
Paste it into the VBA project and have fun.