Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-30-2014, 11:23 AM
winstond winstond is offline Insert quick part when cell contains a value Windows 7 64bit Insert quick part when cell contains a value Office 2010 32bit
Novice
Insert quick part when cell contains a value
 
Join Date: Sep 2014
Posts: 1
winstond is on a distinguished road
Default Insert quick part when cell contains a value

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
Reply With Quote
  #2  
Old 09-30-2014, 11:45 AM
gmaxey gmaxey is offline Insert quick part when cell contains a value Windows 7 32bit Insert quick part when cell contains a value Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

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
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert quick part when cell contains a value Replace text with Quick Part using VBA dmarie123 Word VBA 10 09-18-2014 01:03 AM
Insert quick part when cell contains a value 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

Other Forums: Access Forums

All times are GMT -7. The time now is 02:36 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft