M
Michael Marti Menzel
Hello,
I've been asked to transfer the contents of a batch of Word-documents to
a new format. The problem is that they don't use templates for either of
them (source nor destination), but direct formatting (arghhh!) instead.
So I'm transferring the contents from the MainTextStory from one batch
to the other and applying format replacements to the destination files.
I know, this is not the most elegant way to do it, but that is what my
colleagues want.
I have a problem with the following replacement piece of code, that
among other things replaces a black paragraph background with an
outlined textured background.
With myRange.Find
'El estilo no sirve, porque no es consistente (Titulo 2, Titulo 3)
.Text = ""
.Format = True
.Font.Name = "Arial"
.Font.Size = 12
.Font.Color = wdColorWhite
.Font.Italic = True
.Replacement.Style = "Normal"
.Replacement.Font.Name = "Arial Narrow"
.Replacement.Font.Size = 10
.Replacement.Font.Bold = True
.Replacement.Font.Color = wdColorAutomatic
.Replacement.ParagraphFormat.Alignment = wdAlignParagraphJustify
.Replacement.ParagraphFormat.Borders.OutsideLineStyle =
wdLineStyleSingle
.Replacement.ParagraphFormat.Borders.OutsideLineWidth = wdLineWidth050pt
.Replacement.ParagraphFormat.Borders.OutsideColor = wdColorBlack
.Replacement.ParagraphFormat.Shading.ForegroundPatternColor =
wdColorBlack
.Replacement.ParagraphFormat.Shading.BackgroundPatternColor =
wdColorWhite
.Replacement.ParagraphFormat.Shading.Texture = wdTexture15Percent
.Execute Replace:=wdReplaceAll
End With
This doesn't work. It applies the outside line to the paragraphs, but
not the foreground & background colors, nor the texture.
But I can apply these on a named paragraph without problems e.g.:
ActiveDocument.Sections(2).Range.Paragraphs(1).Shading.ForegroundPatternColor
= wdColorBlack
ActiveDocument.Sections(2).Range.Paragraphs(1).Shading.BackgroundPatternColor
= wdColorWhite
ActiveDocument.Sections(2).Range.Paragraphs(1).Shading.Texture =
wdTexture15Percent
This works... why does the previous example not?
Plattform: Windows XP Pro
Word 2000 - Spanish (Spain)
Thanks in advance for your help!
Miguel
I've been asked to transfer the contents of a batch of Word-documents to
a new format. The problem is that they don't use templates for either of
them (source nor destination), but direct formatting (arghhh!) instead.
So I'm transferring the contents from the MainTextStory from one batch
to the other and applying format replacements to the destination files.
I know, this is not the most elegant way to do it, but that is what my
colleagues want.
I have a problem with the following replacement piece of code, that
among other things replaces a black paragraph background with an
outlined textured background.
With myRange.Find
'El estilo no sirve, porque no es consistente (Titulo 2, Titulo 3)
.Text = ""
.Format = True
.Font.Name = "Arial"
.Font.Size = 12
.Font.Color = wdColorWhite
.Font.Italic = True
.Replacement.Style = "Normal"
.Replacement.Font.Name = "Arial Narrow"
.Replacement.Font.Size = 10
.Replacement.Font.Bold = True
.Replacement.Font.Color = wdColorAutomatic
.Replacement.ParagraphFormat.Alignment = wdAlignParagraphJustify
.Replacement.ParagraphFormat.Borders.OutsideLineStyle =
wdLineStyleSingle
.Replacement.ParagraphFormat.Borders.OutsideLineWidth = wdLineWidth050pt
.Replacement.ParagraphFormat.Borders.OutsideColor = wdColorBlack
.Replacement.ParagraphFormat.Shading.ForegroundPatternColor =
wdColorBlack
.Replacement.ParagraphFormat.Shading.BackgroundPatternColor =
wdColorWhite
.Replacement.ParagraphFormat.Shading.Texture = wdTexture15Percent
.Execute Replace:=wdReplaceAll
End With
This doesn't work. It applies the outside line to the paragraphs, but
not the foreground & background colors, nor the texture.
But I can apply these on a named paragraph without problems e.g.:
ActiveDocument.Sections(2).Range.Paragraphs(1).Shading.ForegroundPatternColor
= wdColorBlack
ActiveDocument.Sections(2).Range.Paragraphs(1).Shading.BackgroundPatternColor
= wdColorWhite
ActiveDocument.Sections(2).Range.Paragraphs(1).Shading.Texture =
wdTexture15Percent
This works... why does the previous example not?
Plattform: Windows XP Pro
Word 2000 - Spanish (Spain)
Thanks in advance for your help!
Miguel