Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2005

Tip: Looking for answers? Try searching our database.

Make letter in bold

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Luc - 14 Feb 2005 17:15 GMT
Hi

I am not a programmer but i taugh this will be the best place to ask

I would like to know what approach i shoul use if i whant to make  special
letter in bold.

Exactly i whant to bold any letter between « ...... » including the double
bracket.

could it be possible to have a macro?

if so any input  will be well receive
Steven Marzuola - 14 Feb 2005 19:09 GMT
> Hi
>
[quoted text clipped - 5 lines]
>
> could it be possible to have a macro?

Luc,

Two parts:  First, here's how to change the « » characters and all
characters between them to display as Bold. Do a Search and Rpelace
for this:

Find what:  («[!»]@»)
Use Wildcards

Replace with: \1
Format: Font, Bold

To create the macro, just record it as you perform that step.

Do you know how to assign macros to keys and/or to buttons on the
toolbar?

Steven
Luc - 14 Feb 2005 19:21 GMT
Not sure how to assign a macro i will have to take a look if it is document i
guess il be able to do it.

but if i would like to start the macro to automatic check what i type and
propose me to bold or not the text. Something like a on off switch. This is
get more complicated i guess.

as for the search i should have taugh about it. sometime we are to involve
in sometihng that we forgot the basic.

Thank

> > Hi
> >
[quoted text clipped - 24 lines]
>
> Steven
Steven Marzuola - 14 Feb 2005 21:43 GMT
Luc,

I'm not sure how to make this an automatic check.  It's something
like a spelling check, you just have to remember to do do it.

But this could help:

How about a macro (invoked by a keystroke or a toolbar button), that
inserts the opening character (« left guillemet) and applies the
attribute you have selected (in this case, Bold).

You type away, and when you're done, click the buttom or press the
keystroke, which runs macro again.  This time it inserts the closing
guillemet character », and turns off the formatting.

If that will help, I can give you some detailed instructions.  What
version of Word do you have?  (There are minor differences, I use
Word 2000).

steven

> Not sure how to assign a macro i will have to take a look if it is document i
> guess il be able to do it.
[quoted text clipped - 36 lines]
>>
>>Steven
Luc - 14 Feb 2005 21:55 GMT
Yep i think that could be interesting.

waiting for your input

Thank

> Luc,
>
[quoted text clipped - 57 lines]
> >>
> >>Steven
Steven Marzuola - 15 Feb 2005 04:05 GMT
Luc,

Here's my suggested macro, and a verbal description.

P.S.  If a more experienced VBA programmer has a more elegant method
to detect whether a particular style exists, I'd like to see it.  Thanks

=======================

Sub FormatGuillemet()

On Error GoTo NoGuillemets

If ActiveDocument.Styles("zGuillemet").Type Then
    GoTo ResumeGuillemets
End If

NoGuillemets:

    ActiveDocument.Styles.Add Name:="zGuillemet",
Type:=wdStyleTypeCharacter
    ActiveDocument.Styles("zGuillemet").BaseStyle = "Default
Paragraph Font"
    ActiveDocument.Styles("zGuillemet").Font.Bold = True

ResumeGuillemets:

If Selection.Style = ActiveDocument.Styles("zGuillemet") Then
    Selection.TypeText Text:="»"
    Selection.Style = ActiveDocument.Styles("Default Paragraph Font")
Else
    Selection.Style = ActiveDocument.Styles("zGuillemet")
    Selection.TypeText Text:="«"
End If

End Sub

=======================

Here's how it works, in words:

Background:  For tasks like this in which you are switching or
"toggling" between two different "states", I prefer to write a
single macro instead of two.  The first step will be to detect which
action needs to be done.  One macro button takes up less space on a
toolbar, and/or uses fewer programmable keys.

Next:  The macro creates a style called "zGuillemet", if the current
document does not already have it.  It then checks whether the
current point in the document has that style.

The first time you run it, of course, you will be in the "Normal"
document style and not "zGuillemet".  The macro will apply the
"zGuillemet" style, which is simply the current style plus Bold,
then type the « character.

The next time you run it, the macro will detect that you are in the
"zGuillemet" style.  It will type the closing guillemet character »
and then switch to the default paragraph style (that is, turning off
the Bold).

As to how to add the macro to your system, I think you should do
some reading of other resources.  Just for starters:

http://word.mvps.org/FAQs/Customization/AsgnCmdOrMacroToToolbar.htm
http://wordprocessing.about.com/od/workingwithmacro1/l/blmacrointro.htm
http://word.mvps.org/FAQs/Customization/AsgnCmdOrMacroToHotkey.htm

Steven

> Yep i think that could be interesting.
>
[quoted text clipped - 20 lines]
>>version of Word do you have?  (There are minor differences, I use
>>Word 2000).

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.