Edit Field - Format settings

R

RichUE

I often record a macro to repeat often-used keystrokes, but today I found a
keystroke that couldn't be recorded. I use Tools, Macros, Record a new Macro
and assign it to a toolbar.
In my document, I have some cross-references to bookmarks. Some bookmarks
begin with a lower-case letter (due to the context in which they are used),
but this may be changed in the cross-reference by right-clicking on the
field, Edit field, Format - First capital.
However, when trying to capture this sequence in a macro recording, the
right-click function is not available. Is there an alternative keystroke I
can use? I couldn't find a relevant menu option.
 
G

Graham Mayor

Some things you cannot do with the macro recorder and you have to code by
hand. In this case you want to add a Firstcap switch to a selected field.
The following is one way to do that

Sub AddFirstCap()
Dim oField As Field
Set oField = Selection.Sentences(1).Fields(1)
If InStr(1, oField.Code.Text, "\*Firstcap") = False Then
oField.Code.Text = oField.Code.Text & " \*Firstcap"
End If
oField.Update
End Sub

http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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