PDA

View Full Version : Solved: Adjustable bullet sizes?



TrippyTom
10-03-2007, 10:11 AM
Hi everyone,

One of the Word templates I have to deal with on a daily basis has different bullet STYLES to accomodate for different font sizes. Isn't there a way to have the bullet size be a percentage of whatever the current font is? If so, how would I reference that in VBA?

I've done this in PowerPoint, but I'm not as familiar with the Word object library, so I was wondering if anyone knew how to do this.

TrippyTom
10-03-2007, 10:39 AM
I did some testing and it seems the only way to change the bullet size is to increase the font size when setting up the bullet. So I guess my only solution is to get the font size of the selection first, then set the bullet size to that value.

... unless anyone has a better idea. :)

lucas
10-03-2007, 10:46 AM
Hi Tom,
Have you investigated styles?

TrippyTom
10-03-2007, 04:05 PM
Yes, we already have styles for each font size, but I was trying to avoid the user having to think about which style to use. There's a TON of them! :)

I want my code to figure it out automatically and choose the style based on the selected font size.

lucas
10-03-2007, 04:56 PM
Why are they selecting a font size instead of using a style then? Seems the bullets can be formatted according to your requirements in the style.

A menu and macros could be added to assign your choice of style to the selection which would adjust font and numbering(bullets) accordingly.

TrippyTom
10-03-2007, 05:23 PM
We're saying the same thing in different ways. I was just wondering if there was an easier solution.

I plan on having the user cick 1 of 4 buttons (Normal, Pros, Cons, Neutral) and let the code behind the scenes figure out which styles to use based on:
1) Font size
2) indent level of text

The color of the bullet will be determined by whichever button they press. This will let the user not have to think about font sizes or styles at all. That's the main goal.

TonyJollans
10-09-2007, 12:46 PM
Just trying to catch up ...

As far as I know, bullet sizes are absolute in styles and the only way to achieve dynamic size bullets is via code.

I can't quite understand what you're trying to achieve. If the user has to choose the font size anyway then you can set the bullet size at the same time; if they already have the font size as they want it and just want the appropriate size bullets when they select bulleting then they must (one way or another) select bullets via a mechanism that can trigger code (toolbar button probably) for you to set the right size.

TrippyTom
10-09-2007, 02:16 PM
bullet sizes are absolute in styles and the only way to achieve dynamic size bullets is via code
Exactly. I was hoping there was an easier way. For instance, in PowerPoint, bullets adjust automatically, so programming a bullets add-in was much easier for me to do there. But it's not the case in Word. Sadly, the object model in Word seems to be even worse than it is in PowerPoint (I didn't think that was possible). Anyway, it seems you have to have a style for EACH font size so the bullet is adjusted accordingly.

Maybe it would help if I run through a typical scenario of how I expect it to work:


...if they already have the font size as they want it and just want the appropriate size bullets when they select bulleting then they must (one way or another) select bullets via a mechanism that can trigger code

This is exactly what I'm trying to do. But before I start coding, I wanted opinions or suggestions if anyone knew of better ways to handle this.

I don't want the user to have to THINK at all. There are simply too many variants in the Styles and Formatting Taskbar to confuse the user and they will inevitably choose the wrong style. There are 10 styles for these bullets, and 10 more if they're inside tables. That's 20 styles alone just for bullets, and that's not even counting how many there would be if font size were included. Too many!

So here's what I want to do in order to simplify the process for the user:

User selects some text
User clicks the PROS buttonI want the macro to:

Record the currentFontSize of the selected text to a variable for use later on when we format the bullet
Figure out what style of bullet to use based on the indent level of each paragraph of the selected text. 1st level = circle, 2nd level = dash, 3rd level = square. I've been researching this and there doesn't seem to be a "indentlevel" option in the Word object library like there is in PowerPoint (I hope there's a workaround for this)
The Pros macro will make the bullet color blue, but the other ones will be different colors (no logic here, just hard-coded color)
Format each paragraph of the selected text with the appropriate bullet and indent. Use the currentFontSize at this time so the bullet size adjusts accordingly.
Now that I've tried to explain it further, I'm sure I've confused you even more. :P

fumei
10-09-2007, 11:18 PM
I don't know. This sounds circular. It sounds like the text they are starting with is NOT a Style. Is this correct?

If the existing text IS a style, then use a style.

I am not following this, as I am stuck on your #1.

"Record the currentFontSize of the selected text to a variable for use later on when we format the bullet"

WHY? WHY? WHY? If there is a current style being used?

TonyJollans
10-09-2007, 11:55 PM
I've recently done a template like this - but simpler - and it's real easy to get in mess. Having different bullet styles in tables is not accommodated for anywhere in Word itself, so you have to intercept bulleting etc., and make sure the appropriate style is in use.

What you have here sounds excessive. 10 (basic) styles for bullets, each perhaps in multiple different font sizes and/or colours - what is the document going to look like?

Anyway, the first thing you really need to understand is how to use ListTemplates. If you don't, you will end up with dozens, maybe hundreds of the things and there is no way to delete them and they will eventually cause corruption. There's an article somewhere on the Word MVP site that explains a lot of the issues and, I think, also some stuff on Shauna Kelly's site.

There isn't any sort of 'Indentlevel' - indentation can be whatever you want it to be. Look at creating Subs called IncreaseIndent and/or DecreaseIndent to trap changes but you can't directly trap usage of the tab key.

From what I understand you seem to be giving your users free rein to create text in any font size (or with any other attributes) and in any position on the page and then allowing them to select a block of that text, click a button and have your code try and interpret what they mean. The more I think about this as I write, the more I think it's horrible. This could get very complex indeed; you should get a clear statement of user requirements. Good luck!

TrippyTom
10-10-2007, 09:12 AM
I was doing a ton of research yesterday at various websites that talk about this issue:
Allen Wyatt's Word Tips - http://wordtips.vitalnews.com/
Shauna Kelley's site - http://www.shaunakelly.com/word/index.html
and... http://www.officearticles.com/word/having_difficulty_with_bullets_and_numbering_in_microsoft_word.htm

Based on the info here and other places, I discovered my company setup the styles incorrectly! After recreating the styles the way they SHOULD be setup, all my concerns have been fixed. The indent level becomes a non-issue because all the levels are set-up in one spot and the bullet symbols change automatically when you Alt + Shift + (left arrow) or (right arrow) to change levels. The bullet size changes with the font size too!

Why does Microsoft provide different ways to setup bullets when the PROPER way is to set it up under the Listbullet styles? NEVER use paragraph formatting and tab formatting to set it up.

So I guess I figured out the answer to my questions. All I have to do is setup the macro now based on the new styles I made.

Thanks for persevering with me guys. :)

fumei
10-15-2007, 10:22 AM
Why does Microsoft provide different ways to setup bullets when the PROPER way is to set it up under the Listbullet styles? NEVER use paragraph formatting and tab formatting to set it up. There is, of course, no answer to the question...why does Microsoft do anything?

However, making the jump in understanding is a GREAT thing!

TrippyTom
10-15-2007, 04:01 PM
Question for Tony,

You mentioned creating Subs to trap changes on indents:

There isn't any sort of 'Indentlevel' - indentation can be whatever you want it to be. Look at creating Subs called IncreaseIndent and/or DecreaseIndent to trap changes but you can't directly trap usage of the tab key.
Now that I have my styles setup properly, the only thing I noticed is if I already have text that I have set various indents on (with TAB or Alt + Shift + (left or right arrow)) when I select all that text and choose one of my styles, they all go to the left as if they were a first level paragraph.

How would I detect indent levels via VBA to avoid this?

TonyJollans
10-16-2007, 01:13 AM
When you set a paragraph style, that includes indenting, and whatever indenting that style has will replace whatever you had previously applied.

What you need to catch indenting are subroutines called IncreaseIndent and DecreaseIndent, but using them won't stop paragraph styles doing what they do.