Reformat Document

K

Kathy

I am looking for assistance to create a macro to reformat
letters from a semi-blocked style to a blocked style. I
am having difficulty in clearing/deleting tabs in
existing documents.

Here is what I have so far. I have had some success with
VBA in Excel, but Word is new to me.

Documents(1).Activate
ActiveDocument.Paragraphs(1).Outdent
ActiveDocument.Paragraphs(1).TabStops(1).Clear

Set myrange = Selection.Range

myrange.WholeStory
myrange.Font.Name = "Arial"
myrange.Font.Size = 12
myrange.ParagraphFormat.Alignment =
wdAlignParagraphCenter
myrange.ParagraphFormat.Alignment =
wdAlignParagraphLeft
myrange.ParagraphFormat.Alignment =
wdAlignParagraphJustify

End Sub

I am a bit puzzled, because if I choose to select all
text and center it, then left align it with the macro
recorder on, I get a document where everything is left
aligned. However if I run the resultant code on a
document, the tabs remain ?

TIA
 
W

Word Heretic

G'day "Kathy" <[email protected]>,

Tab settings are associated with styles, documents and paragraphs.

The trivial way is to remove the tab mark itself, use a simple Find n
Replace to search for Special > Tab mark and replace with nothing.


Kathy said:
I am looking for assistance to create a macro to reformat
letters from a semi-blocked style to a blocked style. I
am having difficulty in clearing/deleting tabs in
existing documents.

Here is what I have so far. I have had some success with
VBA in Excel, but Word is new to me.

Documents(1).Activate
ActiveDocument.Paragraphs(1).Outdent
ActiveDocument.Paragraphs(1).TabStops(1).Clear

Set myrange = Selection.Range

myrange.WholeStory
myrange.Font.Name = "Arial"
myrange.Font.Size = 12
myrange.ParagraphFormat.Alignment =
wdAlignParagraphCenter
myrange.ParagraphFormat.Alignment =
wdAlignParagraphLeft
myrange.ParagraphFormat.Alignment =
wdAlignParagraphJustify

End Sub

I am a bit puzzled, because if I choose to select all
text and center it, then left align it with the macro
recorder on, I get a document where everything is left
aligned. However if I run the resultant code on a
document, the tabs remain ?

TIA

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email (e-mail address removed)
Products http://www.geocities.com/word_heretic/products.html

Replies offlist may require payment.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top