Solved

Get text from form into Word 2010 Document via VBA in .Doc - can't use .Docx 500pnts

Posted on 2014-09-11
2
340 Views
Last Modified: 2014-09-18
Ok,

So ideally what I want to do is have a form with text boxes which a user will fill out when they click the "OK" button the macro should do the following

Copy text string from the text box on the form and paste the value at a book mark in the document.

For example Form1.Text Box with value of "Pat" the macro needs to go to to bookmark FName and paste the content from Form1.Text Box ie "Pat"...

Or I just need to know how to get the value of variable to paste into a document at a certain bookmark...
0
Comment
Question by:ise438
2 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 40318182
Try this to start with:
Sub CommandButton1_Click()
     ActiveDocument.BookMarks("Pat").Range.Text  = UserForm1.TextBox1.Text
End Sub

Open in new window

0
 

Author Closing Comment

by:ise438
ID: 40329928
Worked a treat thank you...
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now