Format Background Colour - Word Table (1 Viewer)

databasedonr

Registered User.
Local time
Today, 02:11
Joined
Feb 13, 2003
Messages
163
Hi there,

I have a two-column table in word, where column one is a static label and column 2 can have 4 values - High, Low, Medium and Nil. What I'd like to do is format the background colour of the cell after the value is entered.

I'm fairly handy with VBA in Access, but am a complete newb at Word and am not familiar with the Word DOM at all. Is there a straightforward way to do this? I've found trying to use the "Drop Down List" in Word is also nightmare, as I thought I might be able to do something there. I tried embedding an excel spreadsheet, but conditional formatting only appears to allow three conditions (I need four), and my users have difficulty with anything other than Word, so I need to stay with a Word table. I'm sure it can be done, just sure I can't do it at this point. Any advise/guidance would be most welcome. I'm using Word 2003 as well....

Thanks in advance.

Don
 

databasedonr

Registered User.
Local time
Today, 02:11
Joined
Feb 13, 2003
Messages
163
Just to let you know, I 'mostly' figured this out. I'm not thrilled with my solution, so if there's some improvements I can make, I'd be happy to hear of them.

What I did was create a series of macros like this:

Sub High()
'warn users if they are not in the table
If Not Selection.Information(wdWithInTable) Then
MsgBox "Put the cursor in the situational scale table", vbOKOnly
Exit Sub
End If

With Selection.Cells
'set the colour on the cell to red for "High"
With .Shading
.ForegroundPatternColor = wdColorRed
.BackgroundPatternColor = wdColorRed
End With
End With
' move to the next line in the table
Selection.MoveDown Unit:=wdLine
End Sub

All the users have to do now is invoke the macros and choose which value they want from the list of values, and the colour is completed. This isn't terribly elegant, but it works.

I've found Word difficult to work with in VBA - could be lack of exposure though - so any tips really would be welcome.

Thanks so much,

Don
 

godsspeed

Registered User.
Local time
Yesterday, 23:11
Joined
Aug 20, 2012
Messages
44
Im not sure what version of word/excel you have, but if its 07 or 10 you can use more than 3 conditional formats. (just make sure that when you are inserting the Excel spreadsheet (Insert-Object) you select the 07/10 option and not the 03 format spreadsheet option (this will limit you to the options available back in 03...yuck)

as far as to which is your best option... i would say inserting an excel spreadsheet, but then it depends on who will be using the word doc, how and how familiar they are with both applications. can you explain a little more about what they'll be doing in the doc?

also, in regards to your vba efforts... i know "nil" lol
 

databasedonr

Registered User.
Local time
Today, 02:11
Joined
Feb 13, 2003
Messages
163
Thanks Godsspeed. Sadly, we're still using Word 2003/Excel 2003. My VBA solution that I posted here is working, and what I've (wisely?) done is change the process to use an Access database and I've programmed that accordingly to give the users both the input and output that they want. That's always the answer for a database guy - build a database to replicate what users are doing in other applications....
 

Users who are viewing this thread

Top Bottom