View Single Post
 
Old 05-30-2019, 08:14 PM
~clover ~clover is offline Windows 10 Office 2013
Novice
 
Join Date: May 2019
Posts: 2
~clover is on a distinguished road
Question Userform to output specific text

Hi all,

Working on a project for work, unfortunately new to VBA and kinda learning as I go. Searched all over today and have not been able to figure this out. I want to create a userform to have a dialog popup with a question and two command button options "yes" or "no" and depending on which option is selected, output specific text at a particular place in the document. Example: dialog box asks "Is the cow green?" options "yes" or "no" if yes is selected "the cow is green" is input into a specific section of the word document, if no is selected "the cow is not green" is input in the same section of the document. Could anyone point me in the right direction where I'm messing up with the code? (obviously this isn't the specific text, but to make things simple we'll use that for the example)
Thanks!!

CommandButton1_Click()

With ActiveDocument
.Bookmarks("Text1").Range _
.InsertBefore TextBox1
the cow is green
.Bookmarks("Text2").Range _
.InsertBefore TextBox2
the cow is not green
End With

UserForm1.Hide

End Sub
Reply With Quote