Font formatting in VBE

D

Doug G

I have some docvariables tied to docvariable fields of which some need to be
BOLD fonts but others tied to the same field do not. If I bold the field in
the document, then all the docvariables are bold which is not my intent. How
can i selectively bold some but not all of the docvariables? I've tried to
highlight the specific variable and "control-B" but it doesn't seem to have
any affect. tx
 
G

Greg Maxey

Sub ScratchMaco()
MsgBox "Use the ""\* CharFormat"" switch in your DocVariable fields and
format" _
& "the ""D"" in ""DocVarialbe"" as ""BOLD"""
End Sub
 
D

Doug G

Greg, thanks for the reply
I copy pasted your macro into a new macro but not sure how to apply your
MsgBox. If i modify the DocVariable field, won't that affect all the
DocVariables associated with that field. Also, i'm not familiar with what the
""\* CharFormat"" switch is and the underscore you referenced after the
FORMAT" below. I think i understand making the "D" in docvariable bold, that
one seems simple enough. Apologies for rookie questions.
 
G

Greg Maxey

Doug,

I was being a bit playful. Your question seemed to deal with DocVariable
fields (vice VBA) and I simply used a VBA messagebox function to provide an
answer. Sorry for the confusion.

Say you have created a variable named "Test"

ActiveDocument.Variables("Test").Value = "This is a test"

In the document you have several fields referencing that variable:

{ DocVariable Test }, {DocVariable Test}, etc.

The oney you want to display as bold construct like this: {DocVariable Test
\* CharFormat } and apply bold text to the "D" in "DocVariable.
 
D

Doug G

Greg, thanks for clarifying. I was able to get your solution to work however
my situation is a reversed concept I think.
My DocVariable Field is shared by a number of DocVariables that are pulled
into the Active Document field based on a pull down menu macro. Some of these
DocVariables I want in BOLD font whereas others I do not, e.g.
DocVariable Field={DocVariable "varApplianceBrand"} and the
DocVariable=ActiveDocument.Variables("varApplianceBrand").Value =
"Frigidaire" or
ActiveDocument.Variables("varApplianceBrand").Value = "General Electric" or
ActiveDocument.Variables("varApplianceBrand").Value = "Viking"
I would like to BOLD font the word "Viking" but not the others when it's
applied to the field.
 

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