Prev: Using Sound Recorder in Word VBA SOMETIMES does not work
Next: Open Multiple Word Files, Copy/Paste into One File
From: Rock on 27 Mar 2010 11:58 Draft 1 Sub MsgBoxmacro() MsgBox "Question #1 here" MsgBox "Question #2 here" MsgBox "Question #3 here" MsgBox "Question #4 here" MsgBox "Question #5 here" MsgBox "Question #6 here" MsgBox "Question #7 here" End Sub Draft 2 Option Explicit Sub MsgBoxmacro() Dim ans1 As String Dim BMs As Bookmarks Dim rng As Word.Range Set BMs = ActiveDocument.Bookmarks ans1 = InputBox("Enter your first name", "Answer #1") If Len(ans1) > 0 Then Set rng = BMs("ans1").Range rng.Text = ans1 Else: Exit Sub End If End Sub I am looking for help with a macro because the macros I have so far are not accomplishing my desired procedure. Can you help me? I have seven questions. I would like to create a macro that when activated will perform the following functions. Display 1st question in message box with field below it to give the answer (ideally the empty field for the answer would be memo format but not required). After the question has been answered I can click stop or continue on the message box. If I click continue the message box will disappear. The question will be pasted in the word document one line below the first line with no text. The answer will be pasted two lines below the recently pasted question, the application will save itself, and a new message box (same format) will appear with the 2nd question. As long as I click continue on the message box the procedure will continue to repeat itself with the 2nd, 3rd, 4th, 5th, 6th, 7th questions, and then loop back to the 1st, 2nd, 3rd, etc questions until I select stop on the message box. If I click stop on the message box the message box will disappear. The question will be pasted in the word document one line below the first line with no text. The answer will be pasted two lines below the recently pasted question, the application will be saved, and the program will stop running. Can you help me with this?
From: Doug Robbins - Word MVP on 27 Mar 2010 17:23 See the article "How to create a Userform" at: http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm and the following page Greg Maxey's website : http://gregmaxey.mvps.org/Create_and_employ_a_UserForm.htm -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "Rock" <Rock(a)discussions.microsoft.com> wrote in message news:434C961C-F1EC-419D-ABEA-8A39FB0FDDAD(a)microsoft.com... > Draft 1 > > Sub MsgBoxmacro() > MsgBox "Question #1 here" > MsgBox "Question #2 here" > MsgBox "Question #3 here" > MsgBox "Question #4 here" > MsgBox "Question #5 here" > MsgBox "Question #6 here" > MsgBox "Question #7 here" > End Sub > > Draft 2 > > Option Explicit > > Sub MsgBoxmacro() > Dim ans1 As String > Dim BMs As Bookmarks > Dim rng As Word.Range > > Set BMs = ActiveDocument.Bookmarks > > ans1 = InputBox("Enter your first name", "Answer #1") > If Len(ans1) > 0 Then > Set rng = BMs("ans1").Range > rng.Text = ans1 > Else: Exit Sub > End If > > End Sub > > I am looking for help with a macro because the macros I have so far are > not > accomplishing my desired procedure. Can you help me? I have seven > questions. > I would like to create a macro that when activated will perform the > following > functions. Display 1st question in message box with field below it to give > the answer (ideally the empty field for the answer would be memo format > but > not required). After the question has been answered I can click stop or > continue on the message box. > > If I click continue the message box will disappear. The question will be > pasted in the word document one line below the first line with no text. > The > answer will be pasted two lines below the recently pasted question, the > application will save itself, and a new message box (same format) will > appear > with the 2nd question. > > As long as I click continue on the message box the procedure will continue > to repeat itself with the 2nd, 3rd, 4th, 5th, 6th, 7th questions, and then > loop back to the 1st, 2nd, 3rd, etc questions until I select stop on the > message box. > > If I click stop on the message box the message box will disappear. The > question will be pasted in the word document one line below the first line > with no text. The answer will be pasted two lines below the recently > pasted > question, the application will be saved, and the program will stop > running. > > Can you help me with this? >
From: Rock on 13 Apr 2010 20:36
Nice. Thank you Doug! "Doug Robbins - Word MVP" wrote: > See the article "How to create a Userform" at: > > http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm > > and the following page Greg Maxey's website : > > http://gregmaxey.mvps.org/Create_and_employ_a_UserForm.htm > > > > -- > Hope this helps. > > Please reply to the newsgroup unless you wish to avail yourself of my > services on a paid consulting basis. > > Doug Robbins - Word MVP, originally posted via msnews.microsoft.com > > "Rock" <Rock(a)discussions.microsoft.com> wrote in message > news:434C961C-F1EC-419D-ABEA-8A39FB0FDDAD(a)microsoft.com... > > Draft 1 > > > > Sub MsgBoxmacro() > > MsgBox "Question #1 here" > > MsgBox "Question #2 here" > > MsgBox "Question #3 here" > > MsgBox "Question #4 here" > > MsgBox "Question #5 here" > > MsgBox "Question #6 here" > > MsgBox "Question #7 here" > > End Sub > > > > Draft 2 > > > > Option Explicit > > > > Sub MsgBoxmacro() > > Dim ans1 As String > > Dim BMs As Bookmarks > > Dim rng As Word.Range > > > > Set BMs = ActiveDocument.Bookmarks > > > > ans1 = InputBox("Enter your first name", "Answer #1") > > If Len(ans1) > 0 Then > > Set rng = BMs("ans1").Range > > rng.Text = ans1 > > Else: Exit Sub > > End If > > > > End Sub > > > > I am looking for help with a macro because the macros I have so far are > > not > > accomplishing my desired procedure. Can you help me? I have seven > > questions. > > I would like to create a macro that when activated will perform the > > following > > functions. Display 1st question in message box with field below it to give > > the answer (ideally the empty field for the answer would be memo format > > but > > not required). After the question has been answered I can click stop or > > continue on the message box. > > > > If I click continue the message box will disappear. The question will be > > pasted in the word document one line below the first line with no text. > > The > > answer will be pasted two lines below the recently pasted question, the > > application will save itself, and a new message box (same format) will > > appear > > with the 2nd question. > > > > As long as I click continue on the message box the procedure will continue > > to repeat itself with the 2nd, 3rd, 4th, 5th, 6th, 7th questions, and then > > loop back to the 1st, 2nd, 3rd, etc questions until I select stop on the > > message box. > > > > If I click stop on the message box the message box will disappear. The > > question will be pasted in the word document one line below the first line > > with no text. The answer will be pasted two lines below the recently > > pasted > > question, the application will be saved, and the program will stop > > running. > > > > Can you help me with this? > > |