I'd like to add some code that would check to see if the text of a bookmark
field is two lines (containing a paragraph mark) and if it is, then to reduce
the font of all those bookmarks to 10 point so it will fit in the allotted
space in my form. Thanks, charlie

Re: reducing font of a bookmark field by Greg

Greg
Fri Jan 07 10:40:05 CST 2005

Charlie,

Something like:

Sub ScratchMacro()
Dim oBkm As Bookmark

For Each oBkm In ActiveDocument.Bookmarks
If InStr(oBkm.Range.Text, vbCr) Then
oBkm.Range.Font.Size = 10
End If
Next oBkm
End Sub


Re: reducing font of a bookmark field by Greg

Greg
Fri Jan 07 10:40:09 CST 2005

Charlie,

Something like:

Sub ScratchMacro()
Dim oBkm As Bookmark

For Each oBkm In ActiveDocument.Bookmarks
If InStr(oBkm.Range.Text, vbCr) Then
oBkm.Range.Font.Size = 10
End If
Next oBkm
End Sub


Re: reducing font of a bookmark field by Charlie

Charlie
Fri Jan 07 15:17:06 CST 2005

Hi again, I tried this but it didn't do anything. I have about 4 different
bookmarks in my form. I have an AutoNew macro running which updates all
fields when I open it. The first fields are 4 (ASK) fields which gets the
data from the user and defines the bookmarks. then the Bookmarks are used
multiple times in the form. The bookmark that may contain 2 lines (a return
key) is called {Location}. I put the code you stated at the end of my
AutoNew() but it didn't change the font of any fields. Is there something
else wrong? I'm not sure how the field propertys works as far as preserving
style on update. Should that be checked? I tried it both ways but it didn't
seem to make a difference. BTW, I'm using Office XP if that helps. Thanks,
charlie

"Greg" wrote:

> Charlie,
>
> Something like:
>
> Sub ScratchMacro()
> Dim oBkm As Bookmark
>
> For Each oBkm In ActiveDocument.Bookmarks
> If InStr(oBkm.Range.Text, vbCr) Then
> oBkm.Range.Font.Size = 10
> End If
> Next oBkm
> End Sub
>
>

RE: reducing font of a bookmark field by Charlie

Charlie
Fri Jan 07 15:19:01 CST 2005

PS. I copied the code out of your scratchmacro and inserted it right at the
end of my AutoNew() macro.

"Charlie" wrote:

> I'd like to add some code that would check to see if the text of a bookmark
> field is two lines (containing a paragraph mark) and if it is, then to reduce
> the font of all those bookmarks to 10 point so it will fit in the allotted
> space in my form. Thanks, charlie

Re: reducing font of a bookmark field by Greg

Greg
Fri Jan 07 16:05:24 CST 2005

Charlie,

Then you don't have bookmarked text in your document, you have REF Fields.
If you proviided the input via a ASK input screen then what you call
paragraph marks are line breaks. Try:

Sub ScratchMacro()
Dim oFld As Field

For Each oFld In ActiveDocument.Fields
If InStr(oFld.Result.Text, Chr(11)) > 0 Then
oFld.Result.Font.Size = 10
End If
Next oFld
End Sub

--
Greg Maxey/Word MVP
A Peer in Peer to Peer Support

Charlie wrote:
> PS. I copied the code out of your scratchmacro and inserted it right
> at the end of my AutoNew() macro.
>
> "Charlie" wrote:
>
>> I'd like to add some code that would check to see if the text of a
>> bookmark field is two lines (containing a paragraph mark) and if it
>> is, then to reduce the font of all those bookmarks to 10 point so it
>> will fit in the allotted space in my form. Thanks, charlie



Re: reducing font of a bookmark field by Charlie

Charlie
Sat Jan 08 10:51:11 CST 2005

GREAT!!! This worked. However, I need to update only a specific field with
the name {LOCATION}, but this changed other fields, too. How do I change
this code to do only the field {location}? many thanks, charlie

"Greg Maxey" wrote:

> Charlie,
>
> Then you don't have bookmarked text in your document, you have REF Fields.
> If you proviided the input via a ASK input screen then what you call
> paragraph marks are line breaks. Try:
>
> Sub ScratchMacro()
> Dim oFld As Field
>
> For Each oFld In ActiveDocument.Fields
> If InStr(oFld.Result.Text, Chr(11)) > 0 Then
> oFld.Result.Font.Size = 10
> End If
> Next oFld
> End Sub
>
> --
> Greg Maxey/Word MVP
> A Peer in Peer to Peer Support
>
> Charlie wrote:
> > PS. I copied the code out of your scratchmacro and inserted it right
> > at the end of my AutoNew() macro.
> >
> > "Charlie" wrote:
> >
> >> I'd like to add some code that would check to see if the text of a
> >> bookmark field is two lines (containing a paragraph mark) and if it
> >> is, then to reduce the font of all those bookmarks to 10 point so it
> >> will fit in the allotted space in my form. Thanks, charlie
>
>
>

Re: reducing font of a bookmark field by Greg

Greg
Sat Jan 08 13:01:28 CST 2005

Charlie,

What have your tried?

Try:

Sub ScratchMacro()
Dim oFld As Field

For Each oFld In ActiveDocument.Fields
If oFld.Type = wdFieldRef Then
If InStr(oFld.Code.Text, "Location") Then
If InStr(oFld.Result.Text, Chr(11)) > 0 Then
oFld.Result.Font.Size = 10
End If
End If
End If
Next oFld
End Sub

--
Greg Maxey/Word MVP
A Peer in Peer to Peer Support

Charlie wrote:
> GREAT!!! This worked. However, I need to update only a specific
> field with the name {LOCATION}, but this changed other fields, too.
> How do I change this code to do only the field {location}? many
> thanks, charlie
>
> "Greg Maxey" wrote:
>
>> Charlie,
>>
>> Then you don't have bookmarked text in your document, you have REF
>> Fields. If you proviided the input via a ASK input screen then what
>> you call paragraph marks are line breaks. Try:
>>
>> Sub ScratchMacro()
>> Dim oFld As Field
>>
>> For Each oFld In ActiveDocument.Fields
>> If InStr(oFld.Result.Text, Chr(11)) > 0 Then
>> oFld.Result.Font.Size = 10
>> End If
>> Next oFld
>> End Sub
>>
>> --
>> Greg Maxey/Word MVP
>> A Peer in Peer to Peer Support
>>
>> Charlie wrote:
>>> PS. I copied the code out of your scratchmacro and inserted it right
>>> at the end of my AutoNew() macro.
>>>
>>> "Charlie" wrote:
>>>
>>>> I'd like to add some code that would check to see if the text of a
>>>> bookmark field is two lines (containing a paragraph mark) and if it
>>>> is, then to reduce the font of all those bookmarks to 10 point so
>>>> it will fit in the allotted space in my form. Thanks, charlie



Re: reducing font of a bookmark field by Greg

Greg
Sat Jan 08 20:16:09 CST 2005

or

Sub ScratchMacro()
Dim oFld As Field

For Each oFld In ActiveDocument.Fields
If InStr(oFld.Code.Text, "Location") _
And InStr(oFld.Result.Text, Chr(11)) > 0 Then
oFld.Result.Font.Size = 10
End If
Next oFld
End Sub


--
Greg Maxey/Word MVP
A Peer in Peer to Peer Support

Charlie wrote:
> GREAT!!! This worked. However, I need to update only a specific
> field with the name {LOCATION}, but this changed other fields, too.
> How do I change this code to do only the field {location}? many
> thanks, charlie
>
> "Greg Maxey" wrote:
>
>> Charlie,
>>
>> Then you don't have bookmarked text in your document, you have REF
>> Fields. If you proviided the input via a ASK input screen then what
>> you call paragraph marks are line breaks. Try:
>>
>> Sub ScratchMacro()
>> Dim oFld As Field
>>
>> For Each oFld In ActiveDocument.Fields
>> If InStr(oFld.Result.Text, Chr(11)) > 0 Then
>> oFld.Result.Font.Size = 10
>> End If
>> Next oFld
>> End Sub
>>
>> --
>> Greg Maxey/Word MVP
>> A Peer in Peer to Peer Support
>>
>> Charlie wrote:
>>> PS. I copied the code out of your scratchmacro and inserted it right
>>> at the end of my AutoNew() macro.
>>>
>>> "Charlie" wrote:
>>>
>>>> I'd like to add some code that would check to see if the text of a
>>>> bookmark field is two lines (containing a paragraph mark) and if it
>>>> is, then to reduce the font of all those bookmarks to 10 point so
>>>> it will fit in the allotted space in my form. Thanks, charlie



Re: reducing font of a bookmark field by Charlie

Charlie
Wed Jan 12 11:19:03 CST 2005

Many Many thanks, Greg
ps. is there some kind of help file download that would help me with basic
word programming that would have lots of examples? The built in help file
seems limited... Thanks, Chalrie

"Greg Maxey" wrote:

> Charlie,
>
> What have your tried?
>
> Try:
>
> Sub ScratchMacro()
> Dim oFld As Field
>
> For Each oFld In ActiveDocument.Fields
> If oFld.Type = wdFieldRef Then
> If InStr(oFld.Code.Text, "Location") Then
> If InStr(oFld.Result.Text, Chr(11)) > 0 Then
> oFld.Result.Font.Size = 10
> End If
> End If
> End If
> Next oFld
> End Sub
>
> --
> Greg Maxey/Word MVP
> A Peer in Peer to Peer Support
>
> Charlie wrote:
> > GREAT!!! This worked. However, I need to update only a specific
> > field with the name {LOCATION}, but this changed other fields, too.
> > How do I change this code to do only the field {location}? many
> > thanks, charlie
> >
> > "Greg Maxey" wrote:
> >
> >> Charlie,
> >>
> >> Then you don't have bookmarked text in your document, you have REF
> >> Fields. If you proviided the input via a ASK input screen then what
> >> you call paragraph marks are line breaks. Try:
> >>
> >> Sub ScratchMacro()
> >> Dim oFld As Field
> >>
> >> For Each oFld In ActiveDocument.Fields
> >> If InStr(oFld.Result.Text, Chr(11)) > 0 Then
> >> oFld.Result.Font.Size = 10
> >> End If
> >> Next oFld
> >> End Sub
> >>
> >> --
> >> Greg Maxey/Word MVP
> >> A Peer in Peer to Peer Support
> >>
> >> Charlie wrote:
> >>> PS. I copied the code out of your scratchmacro and inserted it right
> >>> at the end of my AutoNew() macro.
> >>>
> >>> "Charlie" wrote:
> >>>
> >>>> I'd like to add some code that would check to see if the text of a
> >>>> bookmark field is two lines (containing a paragraph mark) and if it
> >>>> is, then to reduce the font of all those bookmarks to 10 point so
> >>>> it will fit in the allotted space in my form. Thanks, charlie
>
>
>

Re: reducing font of a bookmark field by Greg

Greg
Wed Jan 12 13:06:23 CST 2005

Charlie,

I am not aware of anything like that. Glad I was able to help.