Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7167971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:41:06+00:00 2026-05-28T14:41:06+00:00

In Word 2011 I have a basic macro that prompts the user for input,

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:41:07+00:00Added an answer on May 28, 2026 at 2:41 pm

    wrap the code in a loop that breaks if the user clicks “No”;

    do
       Dim FirstName As String
       .
       .
       .
    
       if (msgbox("Another Name?", vbyesno) = vbno) then exit do
    loop
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Word on the street is that glDrawElements is much faster then glDrawArrays. So I
I have a Word 2003 .dot template that changes its menu based on the
I have a text file that looks like this: [22/Nov/2011 12:57:58] GET /media/js/jquery-1.4.3.min.js HTTP/1.1
I have an XML document like this: <article> <author>Smith</author> <date>2011-10-10</date> <description>Article about <b>frobnitz</b>, crulps
In project i have reference to Microsoft.Office.Word.Server and in code i have method that
Is it possible to open an html document with word, and have anchor links
I have a CSV document that is of the following structure Headers Path,Publish,Hashlist,Package Content
trying to replicate the example here; http://onertipaday.blogspot.com/2011/07/word-cloud-in-r.html Need help figuring out how to increase
I'm storing a Word document in a SQL Server 2005 database in a varbinary(max)
I have a simple Word to Pdf converter as an MSBuild Task. The task

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.