Sign in to follow this  
Followers 0
grakker

Help setting background color in Word

6 posts in this topic

I'm writing a little script that creates a form in word. I first create a table using something like:

Send("{ASC 43}")
Send("{TAB}")

And looping through it 10 times to create something like:

+     +     +     +     +     +     +     +     +

Then send enter and get my 10 row table.  Then I go back through it labeling cells 1-10. That part works fine. What I need to do (This is for tracking credits for students, doing in manually is just repetitive and obnoxious) is highlight a given number of cells. Like if the student has completed 6 credits, 1-6 get's formatted with a yellow background. Something like

_Word_Format_background(#FFFBCC)

I suppose I could do it in Excel, but the form has a bit of writing as well and I thought it would work better in Word. If anyone could help me, I'd be appreciative for sure.

Share this post


Link to post
Share on other sites



pull the emergency break, switch to Excel, use conditional formatting, and you're done.

Share this post


Link to post
Share on other sites

Why create the form by a script? Manually create a template, do all the formatting there and only fill in the data by your script.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

pull the emergency break, switch to Excel, use conditional formatting, and you're done.

 

Yeah, that's pretty much the way I was thinking I would have to go. Wouldn't even have to go to conditional formating as my data comes like 40:13:27 (Requirement:Completed:Needed).

 

Why create the form by a script? Manually create a template, do all the formatting there and only fill in the data by your script.

 

Well, here was my thinking, backwards as it may be: I would like to give this to several colleagues who are asked to do this for students several times a day. I could just tell them to copy the data to a clipboard and run the script. They aren't the most technologically inclined and I worried that they would glass over if I mentioned using a template. At which point they would continue using a blank form and manually highlighting it. Which just bugs me for some reason.

Share this post


Link to post
Share on other sites

I see. Whether Excel or Word is the best solution depends on the amount of formatting you need for the text. Word is a bit more complex to automate using AutoIt.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Well, for what it's worth, I went with Excel and a template. Knocked it out during lunch and sent it around to the colleagues. They were all impressed. It's funny to me that my very rudimentary skills impress people. Need to work on programming literacy...  Thanks for the replies.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0