Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-29-2015, 03:40 PM
ah8471 ah8471 is offline creating a code to create dynamic text in word Windows 10 creating a code to create dynamic text in word Office 2013
Novice
creating a code to create dynamic text in word
 
Join Date: Dec 2015
Posts: 1
ah8471 is on a distinguished road
Default creating a code to create dynamic text in word


Hi guys,
I have a word document and I want to create a code with dynamic fields in it. For instance. When I open the document it should have a command button. When I click the command button then several fields should ask me NAME, AGE, BLOOD PRESSURE, RESPIRATORY RATE and so on.

I want to create a dynamic text which will be created according to an IF Formula. So if BLOOD PRESSURE IS above 160 then write 'Elevated Blood' Pressure in the Word File.

can someone help me with this?

thanks
Reply With Quote
  #2  
Old 12-29-2015, 10:52 PM
gmayor's Avatar
gmayor gmayor is offline creating a code to create dynamic text in word Windows 10 creating a code to create dynamic text in word Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Thumbs up

I would do this with a userform - see the basics at http://www.gmayor.com/Userform.htm You can write the results or alternative texts based on the results to bookmarked locations, docvariables or content controls.

Take for example the part of the userform shown on that page to write a value to a bookmark i.e.

Code:
FillBM "bm1", Me.TextBox1.Text
If TextBox1 is your blood pressure field (it helps to use meaningful field names) then you could modify that to

Code:
If Me.TextBox1.Value > 160 Then 
    FillBM "bm1", "Elevated Blood Pressure"
End If
These are just simple examples. You could for example include error handling to ensure only numeric values are entered in the text box. You'll find code for that and other related things at http://www.gmayor.com/useful_vba_functions.htm
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
Reply

Tags
dynamic fields



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I create a dynamic table of contents dschrader PowerPoint 0 10-12-2015 12:38 PM
creating a code to create dynamic text in word Creating a dynamic summary sheet FenelonPaul Excel 5 09-23-2015 07:11 AM
creating a code to create dynamic text in word How to Create Dynamic Paragraphs in Word Document gt7586d Word 3 02-19-2015 01:02 PM
Dynamic Text in Word pargoooo Word 1 08-22-2013 09:12 AM
creating a code to create dynamic text in word Help Creating A Dynamic Footer Mikemo Word 3 02-05-2013 11:58 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:23 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