![]() |
|
|
|
#1
|
|||
|
|||
|
Hello, I'm creating a userform using Word, and have created a text box for a customer's personal address. If a value is inserted in this text box, I would like to add "Personal Address:" on to the word document and include the value after this, and then a return line. If the text box is left blank, there is no need to insert anything. Would a Quick Part be the best way to do this and if so, could someone point me in the right direction of implementing this? I appreciate your help! Winston |
|
#2
|
|||
|
|||
|
You will have to have a range target to insert the address in. Assuming you have a bookmark "bmPerAddr" then something like this in the userform execute command button code:
Code:
Dim oRng As Word.Range
If txtPerAddr.Text <> vbNullString Then
Set oRng = ActiveDocument.Bookmarks("bmPerAddr").Range
oRng.Text = "Personal Address: " & vbCr & txtPerAddr.Text & vbCr
ActiveDocument.Bookmarks.Add "bmPerAddr", oRng
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Replace text with Quick Part using VBA
|
dmarie123 | Word VBA | 10 | 09-18-2014 01:03 AM |
Custom Header Gallery Quick Part Displays > in 2007 but not 2010
|
sleake | Word | 4 | 10-23-2013 07:10 AM |
| How to Rename a Quick Part | sleake | Word | 14 | 10-14-2013 09:21 AM |
| Copying part of a cell to a new cell | paulw793 | Excel | 7 | 01-27-2012 10:46 AM |
| Date display in Mod quick part header | Jrul John | Word | 1 | 08-02-2010 12:17 PM |