Group:  Microsoft Word ยป microsoft.public.word.mailmerge.fields
Thread: using bookmarks as variables - help!

Geek News

using bookmarks as variables - help!
oldstonebuddha 11/19/2008 9:29:06 PM
Hello,

I am working on creating a contract in Word 2007 in which I want to lock
down most of the document, and then limit certain terms to a predefined
range. As an example, I would like the document end-user to be able to
select billing terms of either:

"thirty (30)" days; or
"sixty (60)" days

So I inserted a dropdown with those choices. I would like their selection
to update text later in the document. So I assigned the dropdown a bookmark
and then inserted a formula field referencing the bookmark. This works,
however it only shows the text in parenthesis (i.e. it shows "(30)" not
"thirty (30)". What is going on? Is there a better way to accomplish this?

Thanks in advance for your help.

Regards




--

Re: using bookmarks as variables - help!
"macropod" <macropod[ at ]invalid.invalid> 11/20/2008 4:36:24 AM
Hi,

I suspect you're referencing the dropdown field with a field coded something like:
{REF Dropdown1 \# 0;0} or {Dropdown1 \# 0;0}
What this *actually* returns is '-30', but the ';0' in the picture switch is forcing it to show as an absolute value. If you had a
field coded something like:
{REF Dropdown1 \# 0} or {Dropdown1 \# 0}
you'd see '-30'.

To get the REF field to show your text, as well as the number, delete the picture switch. That is, use a field coded something like:
{REF Dropdown1} or {Dropdown1}

--
Cheers
macropod
[MVP - Microsoft Word]


"oldstonebuddha" <oldstonebuddha[ at ]discussions.microsoft.com> wrote in message
news:CA211972-2E83-4BA5-B1D1-A365ABB79055[ at ]microsoft.com...
[Quoted Text]
> Hello,
>
> I am working on creating a contract in Word 2007 in which I want to lock
> down most of the document, and then limit certain terms to a predefined
> range. As an example, I would like the document end-user to be able to
> select billing terms of either:
>
> "thirty (30)" days; or
> "sixty (60)" days
>
> So I inserted a dropdown with those choices. I would like their selection
> to update text later in the document. So I assigned the dropdown a bookmark
> and then inserted a formula field referencing the bookmark. This works,
> however it only shows the text in parenthesis (i.e. it shows "(30)" not
> "thirty (30)". What is going on? Is there a better way to accomplish this?
>
> Thanks in advance for your help.
>
> Regards
>
>
>
>
> --
>

Re: using bookmarks as variables - help!
oldstonebuddha 11/20/2008 4:18:29 PM
Hmmm, I was actually using a formula field. I tried the ref field as you
indicated below, and that actually inserts a copy of the dropdown, rather
than the value of the dropdown.

All I want to do is insert the string value selected in the dropdown later
in the document...and have it update as it changes. I'm suprised it is so
difficult to do so. This is simplicity in excel, access, vb...but apparenty
not so much in word.



"macropod" wrote:

[Quoted Text]
> Hi,
>
> I suspect you're referencing the dropdown field with a field coded something like:
> {REF Dropdown1 \# 0;0} or {Dropdown1 \# 0;0}
> What this *actually* returns is '-30', but the ';0' in the picture switch is forcing it to show as an absolute value. If you had a
> field coded something like:
> {REF Dropdown1 \# 0} or {Dropdown1 \# 0}
> you'd see '-30'.
>
> To get the REF field to show your text, as well as the number, delete the picture switch. That is, use a field coded something like:
> {REF Dropdown1} or {Dropdown1}
>
> --
> Cheers
> macropod
> [MVP - Microsoft Word]
>
>
> "oldstonebuddha" <oldstonebuddha[ at ]discussions.microsoft.com> wrote in message
> news:CA211972-2E83-4BA5-B1D1-A365ABB79055[ at ]microsoft.com...
> > Hello,
> >
> > I am working on creating a contract in Word 2007 in which I want to lock
> > down most of the document, and then limit certain terms to a predefined
> > range. As an example, I would like the document end-user to be able to
> > select billing terms of either:
> >
> > "thirty (30)" days; or
> > "sixty (60)" days
> >
> > So I inserted a dropdown with those choices. I would like their selection
> > to update text later in the document. So I assigned the dropdown a bookmark
> > and then inserted a formula field referencing the bookmark. This works,
> > however it only shows the text in parenthesis (i.e. it shows "(30)" not
> > "thirty (30)". What is going on? Is there a better way to accomplish this?
> >
> > Thanks in advance for your help.
> >
> > Regards
> >
> >
> >
> >
> > --
> >
>
>
Re: using bookmarks as variables - help!
"macropod" <macropod[ at ]invalid.invalid> 11/20/2008 9:55:04 PM
Hi,

If you're getting a duplicate of your dropdown field, that suggests you've bookmarked the dropdown field and you're using that
bookmark instead of the dropdown field's internal bookmark. Don't do that - use the dropdown field's internal bookmark instead. To
access the dropdown field's internal bookmark, select the field, right-click and choose 'properties'. There you can insert a
bookmark name (or use whatever's already there). Then delete the other bookmark from your dropdown field and use just the internal
one.

--
Cheers
macropod
[MVP - Microsoft Word]


"oldstonebuddha" <oldstonebuddha[ at ]discussions.microsoft.com> wrote in message
news:1C991AD6-F2D2-49EF-8E5E-CE34D02B9EF4[ at ]microsoft.com...
[Quoted Text]
> Hmmm, I was actually using a formula field. I tried the ref field as you
> indicated below, and that actually inserts a copy of the dropdown, rather
> than the value of the dropdown.
>
> All I want to do is insert the string value selected in the dropdown later
> in the document...and have it update as it changes. I'm suprised it is so
> difficult to do so. This is simplicity in excel, access, vb...but apparenty
> not so much in word.
>
>
>
> "macropod" wrote:
>
>> Hi,
>>
>> I suspect you're referencing the dropdown field with a field coded something like:
>> {REF Dropdown1 \# 0;0} or {Dropdown1 \# 0;0}
>> What this *actually* returns is '-30', but the ';0' in the picture switch is forcing it to show as an absolute value. If you had
>> a
>> field coded something like:
>> {REF Dropdown1 \# 0} or {Dropdown1 \# 0}
>> you'd see '-30'.
>>
>> To get the REF field to show your text, as well as the number, delete the picture switch. That is, use a field coded something
>> like:
>> {REF Dropdown1} or {Dropdown1}
>>
>> --
>> Cheers
>> macropod
>> [MVP - Microsoft Word]
>>
>>
>> "oldstonebuddha" <oldstonebuddha[ at ]discussions.microsoft.com> wrote in message
>> news:CA211972-2E83-4BA5-B1D1-A365ABB79055[ at ]microsoft.com...
>> > Hello,
>> >
>> > I am working on creating a contract in Word 2007 in which I want to lock
>> > down most of the document, and then limit certain terms to a predefined
>> > range. As an example, I would like the document end-user to be able to
>> > select billing terms of either:
>> >
>> > "thirty (30)" days; or
>> > "sixty (60)" days
>> >
>> > So I inserted a dropdown with those choices. I would like their selection
>> > to update text later in the document. So I assigned the dropdown a bookmark
>> > and then inserted a formula field referencing the bookmark. This works,
>> > however it only shows the text in parenthesis (i.e. it shows "(30)" not
>> > "thirty (30)". What is going on? Is there a better way to accomplish this?
>> >
>> > Thanks in advance for your help.
>> >
>> > Regards
>> >
>> >
>> >
>> >
>> > --
>> >
>>
>>

Re: using bookmarks as variables - help!
oldstonebuddha 11/20/2008 10:19:02 PM
I don't see any "internal bookmark" or any way to insert one. I was able to
copy the contents and "paste special" "paste HTML link. That seemed to work.
To get it to auto-update, I had to go into VB and put a "fields.update"
command into the ContentControlOnExit subroutiene:

Private Sub Document_ContentControlOnExit(ByVal ContentControl As
ContentControl, Cancel As Boolean)
Fields.Update
End Sub

Is there a more elegant way to do this...espicially without using a VB code?
Why can't I refrence the content control's value directly? It's a pain
getting a digital signature on the project and configuring end-users options
so they don't have to mess with the macro security every time.

Regards

"macropod" wrote:

[Quoted Text]
> Hi,
>
> If you're getting a duplicate of your dropdown field, that suggests you've bookmarked the dropdown field and you're using that
> bookmark instead of the dropdown field's internal bookmark. Don't do that - use the dropdown field's internal bookmark instead. To
> access the dropdown field's internal bookmark, select the field, right-click and choose 'properties'. There you can insert a
> bookmark name (or use whatever's already there). Then delete the other bookmark from your dropdown field and use just the internal
> one.
>
> --
> Cheers
> macropod
> [MVP - Microsoft Word]
>
>
> "oldstonebuddha" <oldstonebuddha[ at ]discussions.microsoft.com> wrote in message
> news:1C991AD6-F2D2-49EF-8E5E-CE34D02B9EF4[ at ]microsoft.com...
> > Hmmm, I was actually using a formula field. I tried the ref field as you
> > indicated below, and that actually inserts a copy of the dropdown, rather
> > than the value of the dropdown.
> >
> > All I want to do is insert the string value selected in the dropdown later
> > in the document...and have it update as it changes. I'm suprised it is so
> > difficult to do so. This is simplicity in excel, access, vb...but apparenty
> > not so much in word.
> >
> >
> >
> > "macropod" wrote:
> >
> >> Hi,
> >>
> >> I suspect you're referencing the dropdown field with a field coded something like:
> >> {REF Dropdown1 \# 0;0} or {Dropdown1 \# 0;0}
> >> What this *actually* returns is '-30', but the ';0' in the picture switch is forcing it to show as an absolute value. If you had
> >> a
> >> field coded something like:
> >> {REF Dropdown1 \# 0} or {Dropdown1 \# 0}
> >> you'd see '-30'.
> >>
> >> To get the REF field to show your text, as well as the number, delete the picture switch. That is, use a field coded something
> >> like:
> >> {REF Dropdown1} or {Dropdown1}
> >>
> >> --
> >> Cheers
> >> macropod
> >> [MVP - Microsoft Word]
> >>
> >>
> >> "oldstonebuddha" <oldstonebuddha[ at ]discussions.microsoft.com> wrote in message
> >> news:CA211972-2E83-4BA5-B1D1-A365ABB79055[ at ]microsoft.com...
> >> > Hello,
> >> >
> >> > I am working on creating a contract in Word 2007 in which I want to lock
> >> > down most of the document, and then limit certain terms to a predefined
> >> > range. As an example, I would like the document end-user to be able to
> >> > select billing terms of either:
> >> >
> >> > "thirty (30)" days; or
> >> > "sixty (60)" days
> >> >
> >> > So I inserted a dropdown with those choices. I would like their selection
> >> > to update text later in the document. So I assigned the dropdown a bookmark
> >> > and then inserted a formula field referencing the bookmark. This works,
> >> > however it only shows the text in parenthesis (i.e. it shows "(30)" not
> >> > "thirty (30)". What is going on? Is there a better way to accomplish this?
> >> >
> >> > Thanks in advance for your help.
> >> >
> >> > Regards
> >> >
> >> >
> >> >
> >> >
> >> > --
> >> >
> >>
> >>
>
>
Re: using bookmarks as variables - help!
"macropod" <macropod[ at ]invalid.invalid> 11/21/2008 12:25:47 AM
Hi,

Are you using a Content Control 'Drop Down List', or a Dropdown formfield? I've been referring to the latter (available in Word
2007's Controls under 'Legacy Tools', whereas I now suspect you're referring to the former. Dropdown formfields have both a bookmark
value and a 'calculate on exit' option that allows them to update all cross-references without the need for a macro. The formfields
available under the 'Legacy Tools' are also compatible with earlier Word versions - Content Controls are not.

--
Cheers
macropod
[MVP - Microsoft Word]


"oldstonebuddha" <oldstonebuddha[ at ]discussions.microsoft.com> wrote in message
news:348D7D61-EB41-4EFE-A17B-D849F7E071BD[ at ]microsoft.com...
[Quoted Text]
>I don't see any "internal bookmark" or any way to insert one. I was able to
> copy the contents and "paste special" "paste HTML link. That seemed to work.
> To get it to auto-update, I had to go into VB and put a "fields.update"
> command into the ContentControlOnExit subroutiene:
>
> Private Sub Document_ContentControlOnExit(ByVal ContentControl As
> ContentControl, Cancel As Boolean)
> Fields.Update
> End Sub
>
> Is there a more elegant way to do this...espicially without using a VB code?
> Why can't I refrence the content control's value directly? It's a pain
> getting a digital signature on the project and configuring end-users options
> so they don't have to mess with the macro security every time.
>
> Regards
>
> "macropod" wrote:
>
>> Hi,
>>
>> If you're getting a duplicate of your dropdown field, that suggests you've bookmarked the dropdown field and you're using that
>> bookmark instead of the dropdown field's internal bookmark. Don't do that - use the dropdown field's internal bookmark instead.
>> To
>> access the dropdown field's internal bookmark, select the field, right-click and choose 'properties'. There you can insert a
>> bookmark name (or use whatever's already there). Then delete the other bookmark from your dropdown field and use just the
>> internal
>> one.
>>
>> --
>> Cheers
>> macropod
>> [MVP - Microsoft Word]
>>
>>
>> "oldstonebuddha" <oldstonebuddha[ at ]discussions.microsoft.com> wrote in message
>> news:1C991AD6-F2D2-49EF-8E5E-CE34D02B9EF4[ at ]microsoft.com...
>> > Hmmm, I was actually using a formula field. I tried the ref field as you
>> > indicated below, and that actually inserts a copy of the dropdown, rather
>> > than the value of the dropdown.
>> >
>> > All I want to do is insert the string value selected in the dropdown later
>> > in the document...and have it update as it changes. I'm suprised it is so
>> > difficult to do so. This is simplicity in excel, access, vb...but apparenty
>> > not so much in word.
>> >
>> >
>> >
>> > "macropod" wrote:
>> >
>> >> Hi,
>> >>
>> >> I suspect you're referencing the dropdown field with a field coded something like:
>> >> {REF Dropdown1 \# 0;0} or {Dropdown1 \# 0;0}
>> >> What this *actually* returns is '-30', but the ';0' in the picture switch is forcing it to show as an absolute value. If you
>> >> had
>> >> a
>> >> field coded something like:
>> >> {REF Dropdown1 \# 0} or {Dropdown1 \# 0}
>> >> you'd see '-30'.
>> >>
>> >> To get the REF field to show your text, as well as the number, delete the picture switch. That is, use a field coded something
>> >> like:
>> >> {REF Dropdown1} or {Dropdown1}
>> >>
>> >> --
>> >> Cheers
>> >> macropod
>> >> [MVP - Microsoft Word]
>> >>
>> >>
>> >> "oldstonebuddha" <oldstonebuddha[ at ]discussions.microsoft.com> wrote in message
>> >> news:CA211972-2E83-4BA5-B1D1-A365ABB79055[ at ]microsoft.com...
>> >> > Hello,
>> >> >
>> >> > I am working on creating a contract in Word 2007 in which I want to lock
>> >> > down most of the document, and then limit certain terms to a predefined
>> >> > range. As an example, I would like the document end-user to be able to
>> >> > select billing terms of either:
>> >> >
>> >> > "thirty (30)" days; or
>> >> > "sixty (60)" days
>> >> >
>> >> > So I inserted a dropdown with those choices. I would like their selection
>> >> > to update text later in the document. So I assigned the dropdown a bookmark
>> >> > and then inserted a formula field referencing the bookmark. This works,
>> >> > however it only shows the text in parenthesis (i.e. it shows "(30)" not
>> >> > "thirty (30)". What is going on? Is there a better way to accomplish this?
>> >> >
>> >> > Thanks in advance for your help.
>> >> >
>> >> > Regards
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> >
>> >>
>> >>
>>
>>

Re: using bookmarks as variables - help!
oldstonebuddha 11/21/2008 3:23:03 PM
I have been using the content control. How would I refer to a dropdown (or
combobox) content control value (and have it update automatically)? There is
very little information in the help files on content controls. As I stated
earlier, I can do so by pasting an HTML link, but I have to use code to get
it to update the link when a user changes the value.

Thanks for all your help.
--



"macropod" wrote:

[Quoted Text]
> Hi,
>
> Are you using a Content Control 'Drop Down List', or a Dropdown formfield? I've been referring to the latter (available in Word
> 2007's Controls under 'Legacy Tools', whereas I now suspect you're referring to the former. Dropdown formfields have both a bookmark
> value and a 'calculate on exit' option that allows them to update all cross-references without the need for a macro. The formfields
> available under the 'Legacy Tools' are also compatible with earlier Word versions - Content Controls are not.
>
> --
> Cheers
> macropod
> [MVP - Microsoft Word]
>
>
> "oldstonebuddha" <oldstonebuddha[ at ]discussions.microsoft.com> wrote in message
> news:348D7D61-EB41-4EFE-A17B-D849F7E071BD[ at ]microsoft.com...
> >I don't see any "internal bookmark" or any way to insert one. I was able to
> > copy the contents and "paste special" "paste HTML link. That seemed to work.
> > To get it to auto-update, I had to go into VB and put a "fields.update"
> > command into the ContentControlOnExit subroutiene:
> >
> > Private Sub Document_ContentControlOnExit(ByVal ContentControl As
> > ContentControl, Cancel As Boolean)
> > Fields.Update
> > End Sub
> >
> > Is there a more elegant way to do this...espicially without using a VB code?
> > Why can't I refrence the content control's value directly? It's a pain
> > getting a digital signature on the project and configuring end-users options
> > so they don't have to mess with the macro security every time.
> >
> > Regards
> >
> > "macropod" wrote:
> >
> >> Hi,
> >>
> >> If you're getting a duplicate of your dropdown field, that suggests you've bookmarked the dropdown field and you're using that
> >> bookmark instead of the dropdown field's internal bookmark. Don't do that - use the dropdown field's internal bookmark instead.
> >> To
> >> access the dropdown field's internal bookmark, select the field, right-click and choose 'properties'. There you can insert a
> >> bookmark name (or use whatever's already there). Then delete the other bookmark from your dropdown field and use just the
> >> internal
> >> one.
> >>
> >> --
> >> Cheers
> >> macropod
> >> [MVP - Microsoft Word]
> >>
> >>
> >> "oldstonebuddha" <oldstonebuddha[ at ]discussions.microsoft.com> wrote in message
> >> news:1C991AD6-F2D2-49EF-8E5E-CE34D02B9EF4[ at ]microsoft.com...
> >> > Hmmm, I was actually using a formula field. I tried the ref field as you
> >> > indicated below, and that actually inserts a copy of the dropdown, rather
> >> > than the value of the dropdown.
> >> >
> >> > All I want to do is insert the string value selected in the dropdown later
> >> > in the document...and have it update as it changes. I'm suprised it is so
> >> > difficult to do so. This is simplicity in excel, access, vb...but apparenty
> >> > not so much in word.
> >> >
> >> >
> >> >
> >> > "macropod" wrote:
> >> >
> >> >> Hi,
> >> >>
> >> >> I suspect you're referencing the dropdown field with a field coded something like:
> >> >> {REF Dropdown1 \# 0;0} or {Dropdown1 \# 0;0}
> >> >> What this *actually* returns is '-30', but the ';0' in the picture switch is forcing it to show as an absolute value. If you
> >> >> had
> >> >> a
> >> >> field coded something like:
> >> >> {REF Dropdown1 \# 0} or {Dropdown1 \# 0}
> >> >> you'd see '-30'.
> >> >>
> >> >> To get the REF field to show your text, as well as the number, delete the picture switch. That is, use a field coded something
> >> >> like:
> >> >> {REF Dropdown1} or {Dropdown1}
> >> >>
> >> >> --
> >> >> Cheers
> >> >> macropod
> >> >> [MVP - Microsoft Word]
> >> >>
> >> >>
> >> >> "oldstonebuddha" <oldstonebuddha[ at ]discussions.microsoft.com> wrote in message
> >> >> news:CA211972-2E83-4BA5-B1D1-A365ABB79055[ at ]microsoft.com...
> >> >> > Hello,
> >> >> >
> >> >> > I am working on creating a contract in Word 2007 in which I want to lock
> >> >> > down most of the document, and then limit certain terms to a predefined
> >> >> > range. As an example, I would like the document end-user to be able to
> >> >> > select billing terms of either:
> >> >> >
> >> >> > "thirty (30)" days; or
> >> >> > "sixty (60)" days
> >> >> >
> >> >> > So I inserted a dropdown with those choices. I would like their selection
> >> >> > to update text later in the document. So I assigned the dropdown a bookmark
> >> >> > and then inserted a formula field referencing the bookmark. This works,
> >> >> > however it only shows the text in parenthesis (i.e. it shows "(30)" not
> >> >> > "thirty (30)". What is going on? Is there a better way to accomplish this?
> >> >> >
> >> >> > Thanks in advance for your help.
> >> >> >
> >> >> > Regards
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > --
> >> >> >
> >> >>
> >> >>
> >>
> >>
>
>
Re: using bookmarks as variables - help!
"macropod" <macropod[ at ]invalid.invalid> 11/21/2008 9:36:48 PM
Hi,

There are various ways you could approach this.

One way would be create a custom document property, then use your on-ecit macro to update that. The various fields in your document
could then be of the DOCPROPERTY kind, and you could update these via ActiveDocument.Fields.Update.

Another way would be to bookmark each location where you want the value replicated (ie don't bother bookmarking the content control)
and use a macro like:

Sub UpdateBookmark (BmkNm as string, NewTxt as string)
Dim BmkRng as Range
If Documents.Count > 0 then
If ActiveDocument.Bookmarks.Exists(BmkNm) Then
Set BmkRng = ActiveDocument.Bookmarks(BmkNm).Range
BmkRng.Text = NewTxt
ActiveDocument.Bookmarks.Add BmkNm, BmkRng
End if
End if
Set BmkRng = Nothing
End sub

to up date the bookmark. If you've got numerous locations to update, could use REF fields to point to the one updated by this code
and, again, use ActiveDocument.Fields.Update to update the REF fields.

--
Cheers
macropod
[MVP - Microsoft Word]


"oldstonebuddha" <oldstonebuddha[ at ]discussions.microsoft.com> wrote in message
news:79FE69D9-BC36-4F3F-9912-CEDC34A18DC0[ at ]microsoft.com...
[Quoted Text]
>I have been using the content control. How would I refer to a dropdown (or
> combobox) content control value (and have it update automatically)? There is
> very little information in the help files on content controls. As I stated
> earlier, I can do so by pasting an HTML link, but I have to use code to get
> it to update the link when a user changes the value.
>
> Thanks for all your help.
> --
>
>
>
> "macropod" wrote:
>
>> Hi,
>>
>> Are you using a Content Control 'Drop Down List', or a Dropdown formfield? I've been referring to the latter (available in Word
>> 2007's Controls under 'Legacy Tools', whereas I now suspect you're referring to the former. Dropdown formfields have both a
>> bookmark
>> value and a 'calculate on exit' option that allows them to update all cross-references without the need for a macro. The
>> formfields
>> available under the 'Legacy Tools' are also compatible with earlier Word versions - Content Controls are not.
>>
>> --
>> Cheers
>> macropod
>> [MVP - Microsoft Word]
>>
>>
>> "oldstonebuddha" <oldstonebuddha[ at ]discussions.microsoft.com> wrote in message
>> news:348D7D61-EB41-4EFE-A17B-D849F7E071BD[ at ]microsoft.com...
>> >I don't see any "internal bookmark" or any way to insert one. I was able to
>> > copy the contents and "paste special" "paste HTML link. That seemed to work.
>> > To get it to auto-update, I had to go into VB and put a "fields.update"
>> > command into the ContentControlOnExit subroutiene:
>> >
>> > Private Sub Document_ContentControlOnExit(ByVal ContentControl As
>> > ContentControl, Cancel As Boolean)
>> > Fields.Update
>> > End Sub
>> >
>> > Is there a more elegant way to do this...espicially without using a VB code?
>> > Why can't I refrence the content control's value directly? It's a pain
>> > getting a digital signature on the project and configuring end-users options
>> > so they don't have to mess with the macro security every time.
>> >
>> > Regards
>> >
>> > "macropod" wrote:
>> >
>> >> Hi,
>> >>
>> >> If you're getting a duplicate of your dropdown field, that suggests you've bookmarked the dropdown field and you're using that
>> >> bookmark instead of the dropdown field's internal bookmark. Don't do that - use the dropdown field's internal bookmark
>> >> instead.
>> >> To
>> >> access the dropdown field's internal bookmark, select the field, right-click and choose 'properties'. There you can insert a
>> >> bookmark name (or use whatever's already there). Then delete the other bookmark from your dropdown field and use just the
>> >> internal
>> >> one.
>> >>
>> >> --
>> >> Cheers
>> >> macropod
>> >> [MVP - Microsoft Word]
>> >>
>> >>
>> >> "oldstonebuddha" <oldstonebuddha[ at ]discussions.microsoft.com> wrote in message
>> >> news:1C991AD6-F2D2-49EF-8E5E-CE34D02B9EF4[ at ]microsoft.com...
>> >> > Hmmm, I was actually using a formula field. I tried the ref field as you
>> >> > indicated below, and that actually inserts a copy of the dropdown, rather
>> >> > than the value of the dropdown.
>> >> >
>> >> > All I want to do is insert the string value selected in the dropdown later
>> >> > in the document...and have it update as it changes. I'm suprised it is so
>> >> > difficult to do so. This is simplicity in excel, access, vb...but apparenty
>> >> > not so much in word.
>> >> >
>> >> >
>> >> >
>> >> > "macropod" wrote:
>> >> >
>> >> >> Hi,
>> >> >>
>> >> >> I suspect you're referencing the dropdown field with a field coded something like:
>> >> >> {REF Dropdown1 \# 0;0} or {Dropdown1 \# 0;0}
>> >> >> What this *actually* returns is '-30', but the ';0' in the picture switch is forcing it to show as an absolute value. If
>> >> >> you
>> >> >> had
>> >> >> a
>> >> >> field coded something like:
>> >> >> {REF Dropdown1 \# 0} or {Dropdown1 \# 0}
>> >> >> you'd see '-30'.
>> >> >>
>> >> >> To get the REF field to show your text, as well as the number, delete the picture switch. That is, use a field coded
>> >> >> something
>> >> >> like:
>> >> >> {REF Dropdown1} or {Dropdown1}
>> >> >>
>> >> >> --
>> >> >> Cheers
>> >> >> macropod
>> >> >> [MVP - Microsoft Word]
>> >> >>
>> >> >>
>> >> >> "oldstonebuddha" <oldstonebuddha[ at ]discussions.microsoft.com> wrote in message
>> >> >> news:CA211972-2E83-4BA5-B1D1-A365ABB79055[ at ]microsoft.com...
>> >> >> > Hello,
>> >> >> >
>> >> >> > I am working on creating a contract in Word 2007 in which I want to lock
>> >> >> > down most of the document, and then limit certain terms to a predefined
>> >> >> > range. As an example, I would like the document end-user to be able to
>> >> >> > select billing terms of either:
>> >> >> >
>> >> >> > "thirty (30)" days; or
>> >> >> > "sixty (60)" days
>> >> >> >
>> >> >> > So I inserted a dropdown with those choices. I would like their selection
>> >> >> > to update text later in the document. So I assigned the dropdown a bookmark
>> >> >> > and then inserted a formula field referencing the bookmark. This works,
>> >> >> > however it only shows the text in parenthesis (i.e. it shows "(30)" not
>> >> >> > "thirty (30)". What is going on? Is there a better way to accomplish this?
>> >> >> >
>> >> >> > Thanks in advance for your help.
>> >> >> >
>> >> >> > Regards
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> >
>> >> >>
>> >> >>
>> >>
>> >>
>>
>>

Re: using bookmarks as variables - help!
"Peter Jamieson" <pjj[ at ]KillmapSpjjnet.demon.co.uk> 11/23/2008 6:23:47 PM
As far as the content controls side of this is concerned...

You are absolutely right that there is little obvious documentation on how
to use content controls. There is stuff out there on the web, but as far as
I know you cannot make them work the way they are supposed to work without
setting them up with some code (which can be VBA). It's all Word 2007-only.

The idea is that the data in a content control is like a "window" that
displays the value of a piece of data held in an area of the Word document
called the data store. The data store has bits of data defined using XML.
Each content control has an associated piece of XPATH code which tells it
which data in the data store to display. Whenever Word changes the data in
the data store, the values of content controls "connected" to that data
should be updated automatically.

For example, create a dropdown content control, and a plain text content
control, in your document. Using the Properties button in Word's developer
tab, create some rows for the dropdown and give it the title myvalue. Give
the plain text content control the title myvalue as well. It may be useful
to ensure that the controls cannot be deleted.

Copy the following VBA into the VBA editor and run SetUpCustomXMLPart. Click
the "Design Mode" button in Word so that the controls are in their "runtime"
rather than their "design time" state, then try selecting different items in
the dropdown. The results should be reflected in the plain text content
control.

Beyond that, you're on your own if you want to go down this route. The only
thing I would say is that in simple cases such as this, you do not need VBA
to use the form, just to set up the controls so that they reference the data
store correctly. And you may need to ensure that the document is /not/ in
design mode before you use it.

Peter Jamieson

Sub SetUpCustomXMLPart()
Dim objCustomXMLPart As Office.CustomXMLPart
Dim rngStory As Word.Range
Dim objContentControl As Word.ContentControl
Dim objContentControls As Word.ContentControls
Call DeleteAllCustomXMLParts
Set objCustomXMLPart = ActiveDocument.CustomXMLParts.Add
LoadMyCustomXML objCustomXMLPart
' This assumes that the content controls are in the main document body
For Each objContentControl In ActiveDocument.ContentControls
' set all controls with title myvalue to point to the same value in the data
store
If objContentControl.Title = "myvalue" Then
objContentControl.XMLMapping.SetMapping "ns0:mydata/ns0:mydropdownvalue"
End If
Next
Set objCustomXMLPart = Nothing
End Sub

Sub LoadMyCustomXML(myCustomXMLPart As CustomXMLPart)
Dim strXML As String
Const S = vbCrLf
' Define a simple XML value called mydropdownvalue
strXML = "<?xml version='1.0' encoding='UTF-8' standalone='no'?>" & S
strXML = strXML & "<mydata
xmlns='http://www.pjmsn.me.uk/xmlschemas/mydata'>" & S
strXML = strXML & "<mydropdownvalue/>" & S
strXML = strXML & "</mydata>"
myCustomXMLPart.LoadXML strXML
End Sub

Sub DeleteAllCustomXMLParts()
Dim oCustomXMLPart As Office.CustomXMLPart

For Each oCustomXMLPart In ActiveDocument.CustomXMLParts
If Not oCustomXMLPart.BuiltIn Then
oCustomXMLPart.Delete
End If
Next
End Sub
"oldstonebuddha" <oldstonebuddha[ at ]discussions.microsoft.com> wrote in message
news:79FE69D9-BC36-4F3F-9912-CEDC34A18DC0[ at ]microsoft.com...
[Quoted Text]
>I have been using the content control. How would I refer to a dropdown (or
> combobox) content control value (and have it update automatically)? There
> is
> very little information in the help files on content controls. As I
> stated
> earlier, I can do so by pasting an HTML link, but I have to use code to
> get
> it to update the link when a user changes the value.
>
> Thanks for all your help.
> --
>
>
>
> "macropod" wrote:
>
>> Hi,
>>
>> Are you using a Content Control 'Drop Down List', or a Dropdown
>> formfield? I've been referring to the latter (available in Word
>> 2007's Controls under 'Legacy Tools', whereas I now suspect you're
>> referring to the former. Dropdown formfields have both a bookmark
>> value and a 'calculate on exit' option that allows them to update all
>> cross-references without the need for a macro. The formfields
>> available under the 'Legacy Tools' are also compatible with earlier Word
>> versions - Content Controls are not.
>>
>> --
>> Cheers
>> macropod
>> [MVP - Microsoft Word]
>>
>>
>> "oldstonebuddha" <oldstonebuddha[ at ]discussions.microsoft.com> wrote in
>> message
>> news:348D7D61-EB41-4EFE-A17B-D849F7E071BD[ at ]microsoft.com...
>> >I don't see any "internal bookmark" or any way to insert one. I was
>> >able to
>> > copy the contents and "paste special" "paste HTML link. That seemed to
>> > work.
>> > To get it to auto-update, I had to go into VB and put a "fields.update"
>> > command into the ContentControlOnExit subroutiene:
>> >
>> > Private Sub Document_ContentControlOnExit(ByVal ContentControl As
>> > ContentControl, Cancel As Boolean)
>> > Fields.Update
>> > End Sub
>> >
>> > Is there a more elegant way to do this...espicially without using a VB
>> > code?
>> > Why can't I refrence the content control's value directly? It's a pain
>> > getting a digital signature on the project and configuring end-users
>> > options
>> > so they don't have to mess with the macro security every time.
>> >
>> > Regards
>> >
>> > "macropod" wrote:
>> >
>> >> Hi,
>> >>
>> >> If you're getting a duplicate of your dropdown field, that suggests
>> >> you've bookmarked the dropdown field and you're using that
>> >> bookmark instead of the dropdown field's internal bookmark. Don't do
>> >> that - use the dropdown field's internal bookmark instead.
>> >> To
>> >> access the dropdown field's internal bookmark, select the field,
>> >> right-click and choose 'properties'. There you can insert a
>> >> bookmark name (or use whatever's already there). Then delete the other
>> >> bookmark from your dropdown field and use just the
>> >> internal
>> >> one.
>> >>
>> >> --
>> >> Cheers
>> >> macropod
>> >> [MVP - Microsoft Word]
>> >>
>> >>
>> >> "oldstonebuddha" <oldstonebuddha[ at ]discussions.microsoft.com> wrote in
>> >> message
>> >> news:1C991AD6-F2D2-49EF-8E5E-CE34D02B9EF4[ at ]microsoft.com...
>> >> > Hmmm, I was actually using a formula field. I tried the ref field
>> >> > as you
>> >> > indicated below, and that actually inserts a copy of the dropdown,
>> >> > rather
>> >> > than the value of the dropdown.
>> >> >
>> >> > All I want to do is insert the string value selected in the dropdown
>> >> > later
>> >> > in the document...and have it update as it changes. I'm suprised it
>> >> > is so
>> >> > difficult to do so. This is simplicity in excel, access, vb...but
>> >> > apparenty
>> >> > not so much in word.
>> >> >
>> >> >
>> >> >
>> >> > "macropod" wrote:
>> >> >
>> >> >> Hi,
>> >> >>
>> >> >> I suspect you're referencing the dropdown field with a field coded
>> >> >> something like:
>> >> >> {REF Dropdown1 \# 0;0} or {Dropdown1 \# 0;0}
>> >> >> What this *actually* returns is '-30', but the ';0' in the picture
>> >> >> switch is forcing it to show as an absolute value. If you
>> >> >> had
>> >> >> a
>> >> >> field coded something like:
>> >> >> {REF Dropdown1 \# 0} or {Dropdown1 \# 0}
>> >> >> you'd see '-30'.
>> >> >>
>> >> >> To get the REF field to show your text, as well as the number,
>> >> >> delete the picture switch. That is, use a field coded something
>> >> >> like:
>> >> >> {REF Dropdown1} or {Dropdown1}
>> >> >>
>> >> >> --
>> >> >> Cheers
>> >> >> macropod
>> >> >> [MVP - Microsoft Word]
>> >> >>
>> >> >>
>> >> >> "oldstonebuddha" <oldstonebuddha[ at ]discussions.microsoft.com> wrote
>> >> >> in message
>> >> >> news:CA211972-2E83-4BA5-B1D1-A365ABB79055[ at ]microsoft.com...
>> >> >> > Hello,
>> >> >> >
>> >> >> > I am working on creating a contract in Word 2007 in which I want
>> >> >> > to lock
>> >> >> > down most of the document, and then limit certain terms to a
>> >> >> > predefined
>> >> >> > range. As an example, I would like the document end-user to be
>> >> >> > able to
>> >> >> > select billing terms of either:
>> >> >> >
>> >> >> > "thirty (30)" days; or
>> >> >> > "sixty (60)" days
>> >> >> >
>> >> >> > So I inserted a dropdown with those choices. I would like their
>> >> >> > selection
>> >> >> > to update text later in the document. So I assigned the dropdown
>> >> >> > a bookmark
>> >> >> > and then inserted a formula field referencing the bookmark. This
>> >> >> > works,
>> >> >> > however it only shows the text in parenthesis (i.e. it shows
>> >> >> > "(30)" not
>> >> >> > "thirty (30)". What is going on? Is there a better way to
>> >> >> > accomplish this?
>> >> >> >
>> >> >> > Thanks in advance for your help.
>> >> >> >
>> >> >> > Regards
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> >
>> >> >>
>> >> >>
>> >>
>> >>
>>
>>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net