Font Switching Macro?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Lerxst (anonymous_at_discussions.microsoft.com)
Date: 07/26/04


Date: Mon, 26 Jul 2004 13:19:34 -0700

Okay. Thanks for clearing that up. By the way, I'm
curious: Is this for some sort of Greek language learning
tool? In the past I've tinkered with creating a set of
macros to automatically transform Greek terms into
English transliterations and vice versa. I lost hope
after encountering too many ambiguities between omega and
omicron, eta and epsilon. Accents and breathing marks
aren't fun either. Well if that's what you're up to and
you have success, I'd sure be interested in finding out
about it. My suspicion is that it would be necessary to
work from a giant database of whole terms, if one could
get his or her hands on such a thing, rather than trying
to decode terms character by character.

All the best.

>-----Original Message-----
>Lerxst,
>
>Sorry for the confusion. In addtion to you, there are
two
>Greg's, a Chad, and a Dave involved. I am Greg Maxey
>which appears when I use OE at home and just Greg when
>posting from the NG portal at work. My first post never
>displayed here in the NG portal, but I see in in the
>GoogleGroups and in OE. That is odd. After posting I
>went over to the VBA General group and ask a question on
>my code related to an error that was generated. Subject
>is "Help with object deleted error." Dave Lett jumped
in
>provided some great assistance and some cleaned up code.
>Haven't heard anything from the OP since he first posted.
>
>Thanks.
>
>
>>-----Original Message-----
>>Glad an adequate solution has been found. From the
>>information given in the original post, it seemed to me
>>that it would be a toss up between using a doc variable
>>and using an ini file, but I can see that a doc
variable
>>has its advantages for this macro.
>>
>>I'm a bit confused though. Is Greg also the "New Greek
>>Student" who originally posted? And from some of the
>>comments it seems this discussion was simultaneously
>>discussed elsewhere. Has it? Just wondering, because
the
>>discussion seems to have some gaps in it. I would be
glad
>>to read the other comments that I think took place on
>>some other venue.
>>
>>
>>>-----Original Message-----
>>>Lerxst,
>>>
>>>Your solution definately looks more polished than the
>>one
>>>I cobbled together :-). I found it relatively easy to
>>use
>>>a docvariable to store the data, the problem I
>>encountered
>>>was if the user first applied the macro while using
the
>>>symblol font. The result was a ugly error code. With
>>the
>>>help of Dave Lett I found a way around this and it
seems
>>>to work well. At first I thought that you had solved
>>that
>>>issue without even trying. On further study I
realized
>>>that the value in the ini file is saved from document
to
>>>document. I noticed if the value is say TNR, the user
>>>starts a new file with Courier as the default font,
>>>manually applies symbol, then toggles, the toggle will
>>go
>>>to TNR. Just a nit I know. I posted an improvement
of
>>>the code Chad mentions in the VBA general ng. Have a
>>look
>>>if you are interested.
>>>>-----Original Message-----
>>>>I suspect you mean you need to toggle back and forth
>>>>between the two fonts. In this case storing to a
>>variable
>>>>won't work because the variable will lose its value
>>once
>>>>the script is done executing. Instead write it out
>>using
>>>>the system.privateprofilestring method.
>>>>
>>>>Sub ToggleSymbolFont
>>>>If selection.font.name <> "Symbol" then
>>>>System.PrivateProfileString
>>>>("ToggleSymbolFont","Memory","OriginalFont")
>>>>=selection.font.name
>>>>selection.font.name="Symbol"
>>>>Else
>>>>selection.font.name=System.PrivateProfileString
>>>>("ToggleSymbolFont","Memory","OriginalFont")
>>>>End Sub
>>>>
>>>>>-----Original Message-----
>>>>>I'm very new at writing macros for Word and am
hoping
>>>>for some help.
>>>>>
>>>>>I need to write a macro that will allow me to switch
>>>>between my current font
>>>>>and the Symbol font with one keystroke. I don't
know
>>>>how to store the
>>>>>name of the current font as a variable. Following
is
>>>>what I believe would be
>>>>>the simplest script, but I don't know how to make it
>>>>work with VBA.
>>>>>
>>>>>If Selection.Font.Name is not = "Symbol"
>>>>>Then
>>>>> OldFont=.Selection.Font.Name
>>>>> .Selection.Font.Name="Symbol"
>>>>>Else
>>>>> .Selection.Font.Name=OldFont
>>>>>End If
>>>>>
>>>>>Thanks for your help.
>>>>>.
>>>>>
>>>>.
>>>>
>>>.
>>>
>>.
>>
>.
>


Quantcast