Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-03-2016, 09:38 PM
Jiing Chiang Jiing Chiang is offline Editing the text a formula gets me Windows 10 Editing the text a formula gets me Office 2016
Novice
Editing the text a formula gets me
 
Join Date: Jan 2016
Location: Australia
Posts: 11
Jiing Chiang is on a distinguished road
Default Editing the text a formula gets me

I am trying to template specific text to be used in a Word document.

I have set it up so that depending on what the user selects from a drop down box, the relevant templated text appears for that selection.

However, the templated text has areas which the user needs to manually go in and change to what is appropriate for the situation.

How would I go about making this happen? The best thing that I can think of is to have the formula off to the side, and make the user copy and paste the text the formula returns you into a text box, where you can then edit the text.

I have also noticed the colour coding of specific parts of the text (the part the user has to manually change) doesn't come through with the formula.
Attached Images
File Type: png example.png (12.0 KB, 27 views)
Attached Files
File Type: xlsx example.xlsx (10.1 KB, 9 views)
Reply With Quote
  #2  
Old 02-04-2016, 09:10 AM
gebobs gebobs is offline Editing the text a formula gets me Windows 7 64bit Editing the text a formula gets me Office 2010 64bit
Expert
 
Join Date: Mar 2014
Location: Atlanta
Posts: 837
gebobs has a spectacular aura aboutgebobs has a spectacular aura about
Default

Just split your vlookup into parts and concatenate. For the first one, have one vlookup grab text in the first column and then another to grab the time. Then your formula for wakeup will be...

=VLOOKUP(B2,Data!$A$1:$C$5,2,FALSE) & VLOOKUP(B2,Data!$A$1:$C$5,3,FALSE)

Sleep will be similar. The meals, since the variable data is in the middle, requires 3 vlookups.
Reply With Quote
  #3  
Old 02-04-2016, 02:26 PM
Jiing Chiang Jiing Chiang is offline Editing the text a formula gets me Windows 10 Editing the text a formula gets me Office 2016
Novice
Editing the text a formula gets me
 
Join Date: Jan 2016
Location: Australia
Posts: 11
Jiing Chiang is on a distinguished road
Default

Thanks for the reply gebobs, but column B is variable. The sequence will not necessarily be the same. For example, row 2 might be 'Lunch', row 3 might be 'Sleep' and that's it in some scenarios. As the variable part of the sentence changes depending on what is selected and in what order, the formula you have suggested won't account for that.
Reply With Quote
  #4  
Old 02-04-2016, 07:28 PM
macropod's Avatar
macropod macropod is offline Editing the text a formula gets me Windows 7 64bit Editing the text a formula gets me Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Jiing Chiang View Post
I am trying to template specific text to be used in a Word document.
So why not do the lot in Word using, for example, formfields and field coding or content controls and macros?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 02-04-2016, 10:28 PM
Jiing Chiang Jiing Chiang is offline Editing the text a formula gets me Windows 10 Editing the text a formula gets me Office 2016
Novice
Editing the text a formula gets me
 
Join Date: Jan 2016
Location: Australia
Posts: 11
Jiing Chiang is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
So why not do the lot in Word using, for example, formfields and field coding or content controls and macros?
Hi macropd, the reason it has to be done in excel first is because I require another team to fill in the variables for me. The spreadsheet itself is used to satisfy all necessary legal requirements we need to adhere to.

So far i've just got a cell off to the far right with the VLOOKUP stuff in it, where the template text will be held.

I was thinking a copy and paste special macro assigned to a button would work to copy the contents of the cell, and paste special (values) into a text box, which will allow the text to then be edited.

I tried to 'record a macro', but all it did was include the actual templated text within the macro, which means even if the variables are changed, the text won't.

After trying to watch some youtube videos and more googling, I've got this so far... I can get the Copy to work correctly, just don't know how to refer to the textbox...
I recorded a new macro and selected the text box, then typed random words into it just so i could try to figure out the code on how to refer to the textbox, but I seem to be stuck.
Reply With Quote
  #6  
Old 02-04-2016, 11:42 PM
macropod's Avatar
macropod macropod is offline Editing the text a formula gets me Windows 7 64bit Editing the text a formula gets me Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Jiing Chiang View Post
Hi macropd, the reason it has to be done in excel first is because I require another team to fill in the variables for me.
of itself, that doesn't mean you need to involve Excel - it could still all be done in Word.

That said, your users could type their supplemental info into column D on sheet1. The Data sheet could then use formulae like:
="You should wake up tomorrow morning at "&Sheet1!D2&"am."
="You should eat "&Sheet1!D2&" for breakfast tomorrow."
etc.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 02-08-2016, 08:39 PM
Jiing Chiang Jiing Chiang is offline Editing the text a formula gets me Windows 10 Editing the text a formula gets me Office 2016
Novice
Editing the text a formula gets me
 
Join Date: Jan 2016
Location: Australia
Posts: 11
Jiing Chiang is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
of itself, that doesn't mean you need to involve Excel - it could still all be done in Word.

That said, your users could type their supplemental info into column D on sheet1. The Data sheet could then use formulae like:
="You should wake up tomorrow morning at "&Sheet1!D2&"am."
="You should eat "&Sheet1!D2&" for breakfast tomorrow."
etc.
Hi macropd, appreciate yours and others' input so far.

I've figured out a way to resolve my issues. For anyone else that has looking for a solution to a similar problem, I simply output the text in 'hidden' cells (by that I mean i've just made the text output to cell AC2, AC3 etc). I then inserted an ActiveX button with the following macro:

Sub fillstrategy()
'
' fillstrategy Macro
Sheets("PP").TextBoxes("TextBox 12").Text = Sheets("PP").Range("AC2").Value
Sheets("PP").TextBoxes("TextBox 13").Text = Sheets("PP").Range("AC3").Value
Sheets("PP").TextBoxes("TextBox 14").Text = Sheets("PP").Range("AC4").Value

End Sub

This way the relevant text from the items selected in the drop down menu are auto-filled into the text boxes.

The users then read through the templated text, and update the areas that i've marked with ##XXXXXXXX##.

Just one last question: Is there any way to highlight the ##XXXXX## sections of the templated text? I've highlighted the sections in red in the 'raw data', but when the text pulls through from the INDEX formula, it comes through all black, without the ##XXXX## sections highlighted in red.

And we require the use of excel as our client's data is automatically fed into excel which then auto-populates relevant sections. Appropriate financial calculations are then performed using that data. The outcome of this background research/calculations are then outputted to a templated word document.
Reply With Quote
  #8  
Old 02-08-2016, 10:01 PM
macropod's Avatar
macropod macropod is offline Editing the text a formula gets me Windows 7 64bit Editing the text a formula gets me Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Jiing Chiang View Post
Just one last question: Is there any way to highlight the ##XXXXX## sections of the templated text? I've highlighted the sections in red in the 'raw data', but when the text pulls through from the INDEX formula, it comes through all black, without the ##XXXX## sections highlighted in red.
Excel formulae cannot capture and output font attributes; only the raw text/values.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
formatting consistency drofla Word 2 06-03-2015 10:53 PM
Editing the text a formula gets me editing content for visual consistency eNGiNe PowerPoint 3 03-31-2015 12:31 PM
Editing the text a formula gets me Maintaining Consistency across multiple documents Yann Word 1 04-19-2012 08:07 PM
Vertical lines nigo75 Project 3 09-13-2011 04:03 AM
Vertical climberman Word 2 12-29-2009 09:53 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:40 PM.


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