In Word 2011 I have a basic macro that prompts the user for input, then formats that input and puts it into the document. For example:
Sub AddNewName()
'
' AddNewName Macro
'
'
Dim FirstName As String
FirstName = InputBox("Enter First Name", "")
Dim LastName As String
LastName = InputBox("Enter Last Name", "")
Selection.TypeText Text:="First Name : "
Selection.TypeText Text:=FirstName
Selection.TypeParagraph
Selection.TypeText Text:="Last Name : "
Selection.TypeText Text:=LastName
End Sub
I would like it to ask the user at the end: “Another Name? y/n” and if the user answers “y” then start the macro over again. I’ve Googled and searched stackoverflow but I either am not using the right search terms or the question just isn’t out there already.
wrap the code in a loop that breaks if the user clicks “No”;