I've got a macro that updates a copyright header with the most recent edit date.
The problem I have is that the macro currently reads through the entire file rather than just the first 6 lines (which is all it needs).
Is there a way to get the Macro to only read the first "X" lines rather than the entire file?
Private selection As EnvDTE.TextSelection = DTE.ActiveDocument.Selection
Private Sub UpdateCopyrightHeader()
selection.StartOfDocument()
selection.EndOfDocument(True)
Dim content As String = selection.Text
Dim result = System.Text.RegularExpressions.Regex.Replace(content, regex, "<lastedit>" & FormatDateTime(Date.Now, vbLongDate) & "</lastedit>")
selection.Delete()
selection.Collapse()
Dim ed As EditPoint = selection.TopPoint.CreateEditPoint()
ed.Insert(result)
End Sub