[comp.windows.ms] winword question?

terryc@bnr.ca (Terry Clouthier) (05/30/91)

  Can styles apply to text within a paragraph?  
  For example, I want to create a style for variable names.
  This would allow me to change the formatting for all 
  variables in the document by changing the style.

  If styles can't help is there something less I
  can use to accomplish this?


  Thanks
  Terry

gg2@cunixf.cc.columbia.edu (Guy Gallo) (05/31/91)

In article <1991May30.131636.5020@bmers145.bnr.ca> terryc@bnr.ca (Terry Clouthier) writes:
>
>  Can styles apply to text within a paragraph?  
>  For example, I want to create a style for variable names.
>  This would allow me to change the formatting for all 
>  variables in the document by changing the style.
>
>  If styles can't help is there something less I
>  can use to accomplish this?

Terry,

No, you can't define a style within a style.  However, you can create a macro
to change the character formatting...  For instance, I wanted to to precisely
the same thing in a documentation file (the main font was Times, and I wanted
keywords in Swiss).  What follows is a macro that 1) if the selection is a 
block (a highlighted word), apply Swiss, or 2) if the selection is an insertion
point, either turn Swiss on or off:

Sub MAIN 
If SelType() = 2 Then 
	Font "Swiss", 10 
	Bold 1 
Else 
	CharLeft 
	F$ = Font$() 
	CharRight 
	If F$ <> "Swiss" Then 
		Font "Swiss", 10 
		Bold 1 
	Else 
		ResetChar 
	End If 
End If 
End Sub 

Another way you can do this in WfW is to do a search and replace for the
keyword you want to change, and in the Replace edit box, set the font to
whatever you want by cycling through the available fonts (Ctrl-F) or
by applying the attribute you want (Ctrl-B, for instance if you want the
word replaced as Bold).  The Replace function is very powerful.  

Hope this helps