View Single Post
 
Old 12-17-2017, 10:17 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Sorry. I missed that bit

Add the following two lines before Next iQuest i.e.
Code:
        oAns.End = oAns.Paragraphs(1).Range.End - 1
        oAns.Text = ""
    Next iQuest    'and process the next question
This will remove the text from the line with the answer. If you remove the line it will screw up the count. However if you don't want the extra empty lines, use the following:
Code:
Sub ClearBlanks()
Dim oPara As Paragraph
    On Error Resume Next
    For Each oPara In ActiveDocument.Paragraphs
        If Len(oPara.Range) = 1 Then If Len(oPara.Range.Next.Paragraphs(1).Range) = 1 Then oPara.Range.Delete
    Next oPara
lbl_Exit:
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote