merrymonk has asked for the wisdom of the Perl Monks concerning the following question:

As an extension to being able to replace existing text strings with alternate text string and wingdings in a Word document, I want to set:
1. the background cell colour when the existing string is in a table;
2. the background paragraph cell colour when the existing string is not in a table.
I can find out whether or not the existing text string is in a cell using
$selection->Find->ClearFormatting; $selection->Find->{Text} = $existing_string; $find_sb_item = $selection->Find->Execute; $intable_res = 0; if($find_sb_item == 1) { $intable_res = $selection->Information(wdWithInTable); }
with $intable being 1 with the selection point is in the table and 0 when not.
I found in http://www.microsoft.com/technet/scriptcenter/resources/officetips/apr05/tips0407.mspx the following code for VBA
Const wdColorWhite = 16777215 Const wdColorGray10 = 15132390 Const wdColorYellow = 65535 Set objWord = CreateObject("Word.Application") objWord.Visible = True Set objDoc = objWord.Documents.Add() Set objSelection = objWord.Selection i = 1 objSelection.ParagraphFormat.Shading.BackgroundPatternColor = wdColorG +ray10 objSelection.TypeText "This is the first paragraph." objSelection.TypeParagraph()
I always struggle going from VBA to Perl, however, I thought that the following may work.
$wdColorGray10 = 15132390; $selection->ParagraphFormat->Shading ({BackgroundPatternColor => $wdCo +lorGray10});
Sadly nothing happened to either the cell or paragraph background colour. Does any Monk know how to do what I want?</code>