Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Benz[_2_] Benz[_2_] is offline
external usenet poster
 
Posts: 1
Default Word 2003 - Macros, Styles, and XML

I'm trying to create a macro that will insert xml markup before and
after text containing certain styles. I don't have much experience
creating macros, but below is what I have so far for this macro. It
seems to work for all the A heads in my document except for the last
one.

Sub Macro3()

Selection.HomeKey wdStory
Selection.Find.ClearFormatting
Do
Selection.Find.Style = ActiveDocument.Styles("A head")
With Selection.Find
.Text = ""
.Replacement.Text = "ahead/ahead"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.HomeKey Unit:=wdLine
Selection.TypeText Text:="ahead"
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:="/ahead"
Loop Until (Selection.End = ActiveDocument.Content.End)
End Sub

I'm sure there is a better way to add xml code to styled text in a
Word doc, but I'm not quite sure where to start. I thought using
macros might be the best solution for now. I work in academic
publishing and our manuscripts need to be marked up with xml for our
typesetters.

Thanks in advance for any help!
Bendte

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Macros in MS Word 2003 Linda Wilson Microsoft Word Help 1 February 17th 06 10:26 PM
Macros in Word 2003 DOCdoc Microsoft Word Help 0 November 10th 05 06:26 PM
Macros in Word 2003 betty Microsoft Word Help 2 November 4th 05 07:11 PM
Macros in Word 2003 TCFRAZ Microsoft Word Help 2 May 3rd 05 10:48 PM
BUG in Word 2003: Styles Organiser won't copy Styles with spaces Rick Raubenheimer Microsoft Word Help 2 March 31st 05 02:57 PM


All times are GMT +1. The time now is 04:51 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"