How do you create this toolbar function?

M

M Skabialka

A friend says he has a function button on his Word Toolbar where you can
highlight text, click this button once and get a chnaged format to Sentence
Case, click again and get lowercase and so on. There is a picture icon on
this button rather than text. What would be the code to create such a
function? And how would you make it have an icon rather than the function
name on the toolbar?
 
T

Tony Jollans

Shift+F3 will do this.

To put the function on a toolbar ...

Select Tools > Customize from the Menu
Select the Commands tab
Under Categories select "All Commands"
Under Commands select "Change Case" and click and drag to your toolbar of
choice

When the text is on your toolbar, right click on it and ...

Select Change Button Image to get an icon
Select text Only in Menus to suppress the text
Play around till you get what you want

No code needed.
 
G

Greg Maxey

Tony,

Agree with Shift+F3

However, putting the builtinChangeCase icon on a toobar doesn't
automatically toggle the case. It opens a dialog for the user to
choose the case or toggle the case.
 
T

Tony Jollans

Hi Greg,

Word is nothing if not confusing :)

Under Tools > Customize, in the "Format" Category there is "Change Case"
(which doesn't have an icon) that does the cycling and "Change Case..."
(which does have the "AAa" icon) that brings up the dialog.

Under the "All Commands" Category, the second one is called
"FormatChangeCase"
 
M

M Skabialka

Perfect - just what I needed. And I was also able to add an icon - but I
had to do it while I had Tools, Customize, Commands open. I was then able
to select properties on the new button and change the button image.

While I have your experitse - can you tell me the command to change a
document from portrait to landscape, which I would then add another button
for?

Thanks,
Mich
 
G

Greg Maxey

Try:

Sub Macro1()
With ActiveDocument.PageSetup
If .Orientation = wdOrientLandscape Then
.Orientation = wdOrientPortrait
Else
.Orientation = wdOrientLandscape
End If
End With
End Sub
 
M

M Skabialka

This worked great with the face image (thinking of a portrait!)

I then went back and edited icons for the other macros - this is way cool!

Thanks!
Mich
 

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