Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word 2010 Select only bulletted text to alter formatting

Status
Not open for further replies.
Jan 12, 2011
18
GB
Hello people,
I am correcting the formatting on a series of documents, and have written a macro to open each document in turn, and do things to them. One of the things I would like to do is to put a space of 10 points before and after each paragraph of all text that is not bulleted, or alternatively, put a zero point space before and after bulleted text.

I have got as far as putting the spaces in all of the text of the letter, but I do not know how to select all text which is bulleted, so I can put the space to 0. The help file mentions a ParagraphFormat2.Bullet Property, but I can't seem to work that, and I am stuck.

Any ideas much appreciated, and thanks for taking the time to read this.

Mark

 


Hi,

Check out the Paragraphs collection. You can loop thru each paragraph...
Code:
dim pgh as paragraph

for each pgh in thisdocument.paragraphs
  with pgh

  end with
next
then use the Watch Window to examine the pgh object and 'discover' what objects and properties you need to expose in order to find the paragraphs you want to include.

You will get better answers to VBA questions in forum707.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thanks - it seems I keep putting my posts in the wrong place - the last lot told me to go here :p I'll try what you suggest... but not till Monday now.
 


You have but one post. How can that be?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I posted in some random place about ayara VBA or something, but not to worry, I'm sure your post will prove fruitful next week.
 
Hi Mark,

If your documents use a specific paragraph Style (as they should) to manage the formatting, all you need to do is to change the Style definition. If you're not already doing that, I'd recommend defining such a Style, copying it to each document, then applying that Style to each bulleted paragraph in the document. Depending on how many bulleting levels you have, you might need two or more such Styles, applying each as appropriate.

Cheers
Paul Edstein
[MS MVP - Word]
 
Yes, they have styles, and all the letters use the same custom style for the bullet text (Letter Bullet) and likewise for the other text (Normal). Something like this then, you think? ( I'm not on my pc so the syntax is probably wrong, but hopefully you get the sense)
Code:
With ActiveDocument.WholeStory
    If .paragraph.style = ("normal") then
        .paragraph.SpaceBefore = 10
        .paragraph.SpaceAfter = 10
    End If
End With
I think I may have been overcomplicating things by spoiling the pristine styles, when it seems you are suggesting I should in fact be using those styles to make my changes.

The only problem might be that presumably once I have changed the paragraph format as above, the paragraphs will no longer have format ("normal"), so I will not be able to run similar changes on the letters again..?
 
Hi Mark,
You work with the Styles directly:
Code:
With ActiveDocument
  With .Styles("Letter Bullet").ParagraphFormat
    .SpaceBefore = 0
    .SpaceAfter = 0
  End With
  With .Styles("Normal").ParagraphFormat
    .SpaceBefore = 10
    .SpaceAfter = 10
  End With
End With

Cheers
Paul Edstein
[MS MVP - Word]
 
Or enable the 'Don't add space between paragraphs of the same style' option for "Letter Bullet" style?

Regards: Terry
 
Hi tf1,

That would still leave whatever existing leading space there is before the 1st bullet point and whatever existing trailing space there is after the last bullet point.

Cheers
Paul Edstein
[MS MVP - Word]
 
I thought that was a desirable result consequence ;-)

Regards: Terry
 
Hi Terry,

Maybe so, but that's not what the OP spec'd.

Cheers
Paul Edstein
[MS MVP - Word]
 
Hi again people - hope you all had a good weekend.

Just to clarify a couple of points discussed: the letters are already written, with formats in Place, so the "don't add space between paragraphs box" is not so useful, but thanks for the idea. Also there are no empty lines on any of the letters; the formatting comes straight from the paragraph spacing in the styles used, so there will be no issues with leading spaces etc if the format is edited. I've been in a meeting so far today, but I'll try the suggestions this afternoon.

Thanks to all for help!
 
Apologies for the delay in answering - I have now managed to sort this, thanks to all your help. Thanks again, everyone!
 


I have now managed to sort this

Please share your solution with the other members of Tek-Tips. This is both the polite and customary thing to do.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Apologies - I sorted it in the end by changing the requirements, rather than a bona fide result such as would be seen as interesting on this forum. I have removed a lot of the bulletted text. While this is not really the solution I was after, it became necessary due to time constraints on the project. Thanks all for your replies, and apologies again for not being a very attentive forum user - I will improve.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top