Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WORD VBA Cell Shading - NO FILL

Status
Not open for further replies.

WBURKERT

Technical User
May 28, 2010
73
I am trying to figure out the command to clear the shading in a particular cell within a WORD table.

How come you can't record WORD macro's that are table related?

Is there any place with all the commands and their syntax, I can not seem to find one good book or one good website for command structures and repitoire. Thank goodness Tek-Tips exists!
 
When in VBE feel free to use the F2 (Object browser) and F1 (Help) keys.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PH,

Thank you for showing me F2, F1 doesn't seem that helpful. This is the command I use for formatting a cell

ParagraphFormat.Alignment = wdAlignParagraphRight

This the routine
For Each aCell In aTable.Columns(2).Cells
aCell.Range.ParagraphFormat.Alignment = wdAlignParagraphRight
Next

I thought the command would look like
aCell.Range.ParagraphFormat

but darn if I can figure out the format or how to use the no fill value. all the examples show how to fill a cell with a color, I'm trying to remove one.

Please give me a little more of a teaser.
 
Here is what I am trying now but get an error, just a little help.

For Each aCell In aTable.Columns(4).Cells
aCell.Range.ParagraphFormat.Shading = wdCellColorNoHighlight
Next
 
So I can change the color but how the heck do you do a NOFILL? Maybe this is not correct either???
Thanks in advance for this one.

For Each aCell In aTable.Columns(4).Cells
aCell.Range.ParagraphFormat.Shading.Texture = wdTextureNone
aCell.Range.ParagraphFormat.Shading.ForegroundPatternColor = wdColorBlack
aCell.Range.ParagraphFormat.Shading.BackgroundPatternColor = wdColorBlack
Next
End If
 
Code:
    With Selection.Cells
        With .Shading
            .Texture = wdTextureNone
            .BackgroundPatternColorIndex = wdAuto
        End With
        .Borders.Shadow = False
    End With

_________________
Bob Rashkin
 
Set the colour to [tt]wdColorAutomatic[/tt].

combo
 
I am great with logic but horrible with the syntax, sometimes tidbits of info is good for me but info without examples does little good. If the 'bong' solution works then that is great because it gets the job done. Maybe each successive macro will be better coding??

 
Of the two logic versus syntax, IMO, logic is BY FAR more important is figuring things out.

The logic is that each attribute (fill, texture blah blah blah) is a separate item.

You coul dsee this if you recorded a macro, first putting in a fill, and then...removing it.

Gerry
 
Fumei,

I am glad you said that - I can not seem to get macro recorded when I used tables. If I start outside the table I can not select anything within the table, if I start inside the table I still can't the mouse to control or highlight cells. I have learned alot from recording macros but not when working with tables.

Maybe i should try not using the mouse but instead the arrow keys??

That's how I found out about texture, background and foreground colors.
 
Maybe i should try not using the mouse but instead the arrow keys??"

Yes, and here is another hint. When you are recording a macro and you find something is not available to you that you normally use a right click for, use Shift-F10. This is the standard Windows equivalent to a right-click and it DOES work when recording macros. At least for most things.

Between that and using the arrow keys you can get your recording to do things you may not otherwise be able to achieve.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top