Font Switching Macro?
From: Greg (anonymous_at_discussions.microsoft.com)
Date: 07/26/04
- Next message: MSizlak: "ResetChar"
- Previous message: Chad DeMeyer: "Re: Programatically Creating a Hyperlink"
- In reply to: Lerxst: "Font Switching Macro?"
- Next in thread: Lerxst: "Font Switching Macro?"
- Reply: Lerxst: "Font Switching Macro?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 26 Jul 2004 12:53:05 -0700
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.
>>>>.
>>>>
>>>.
>>>
>>.
>>
>.
>
- Next message: MSizlak: "ResetChar"
- Previous message: Chad DeMeyer: "Re: Programatically Creating a Hyperlink"
- In reply to: Lerxst: "Font Switching Macro?"
- Next in thread: Lerxst: "Font Switching Macro?"
- Reply: Lerxst: "Font Switching Macro?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|