That almost did the trick, Shawn. It handles the headers/footers and footnotes/endnotes fine. Curiously, however, it leaves the main body of the text untouched.
I substituted the script I posted earlier -- the one that successfully handles the main text -- for the section of your script that deals with the main document. Voila! The system works!
I'll append the revised script to this post. I can't comment on its elegance or lack thereof, and of course I invite you to streamline it to your heart's content. But it does the trick as is. Many thanks.
BTW, I run my tests of this on a test file I created that includes underlined text in main body, header, and footnotes. So I know when it works and when it doesn't.
Also, now that I see where you position the search terms, I can easily tweak this for any other replacement I might desire. As I'm not the only person who needs such a script, I encourage you to post this somewhere as a downloadable .zip file to benefit the Word '08 community.
Here's the revised Underline to Italic script:
tell application "Microsoft Word"
activate
(* Active Document *)
set myFind to find object of text object of active document
clear formatting myFind
set underline of font object of myFind to true
set content of myFind to ""
clear formatting replacement of myFind
set underline of font object of replacement of myFind to false
set italic of font object of replacement of myFind to true
set content of replacement of myFind to ""
execute find myFind replace replace all
(*Headers & Footers *)
-- Create list of all sections in active document
set lstSections to every section of active document
repeat with currSection in lstSections
-- Create list of all headers and footers in active document
set lstHeaderFooters to {get header currSection index header footer primary} & {get header currSection index header footer first page} & {get header currSection index header footer even pages} & {get footer currSection index header footer primary} & {get footer currSection index header footer first page} & {get footer currSection index header footer even pages}
-- Loop through all headers and footers
repeat with currHeaderFooter in lstHeaderFooters
set myFind to find object of text object of currHeaderFooter
set content of myFind to ""
clear formatting myFind
set underline of font object of myFind to true
clear formatting replacement of myFind
set content of myFind to ""
set italic of font object of replacement of myFind to true
set underline of font object of replacement of myFind to false
execute find myFind replace replace all
-- Create list of all shapes in header and footer
set lstShapes to (every shape of currHeaderFooter)
-- Loop through all shapes in header and footer
repeat with currShape in lstShapes
if has text of (text frame of currShape) then
set myFind to find object of text range of text frame of currShape
set content of myFind to ""
clear formatting myFind
set underline of font object of myFind to true
clear formatting replacement of myFind
set content of myFind to ""
set italic of font object of replacement of myFind to true
set underline of font object of replacement of myFind to false
execute find myFind replace replace all
end if
end repeat
end repeat
end repeat
(* Footnotes *)
-- Create list of all footnotes in active document
set lstFtNotes to every footnote of active document
-- Loop through all footnotes
repeat with currFtnote in lstFtNotes
set myFind to find object of text object of currFtnote
set content of myFind to ""
clear formatting myFind
set underline of font object of myFind to true
clear formatting replacement of myFind
set content of myFind to ""
set italic of font object of replacement of myFind to true
set underline of font object of replacement of myFind to f