Solved

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

Posted on 2014-09-11
2
346 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

920 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

17 Experts available now in Live!

Get 1:1 Help Now