WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Userforms -> Bookmarks Vs Doc Variables

 
   Home -> Office -> User Forms RSS
Next:  How do I get back in the insert mode in MSWorks? ..  
Author Message
Shane

External


Since: Mar 13, 2008
Posts: 1



(Msg. 1) Posted: Thu Mar 13, 2008 3:15 am
Post subject: Userforms -> Bookmarks Vs Doc Variables
Archived from groups: microsoft>public>word>vba>userforms (more info?)

Hi.

I've notice a number of times the recommendation to use Doc Variable
instead of Bookmarks to hold data entered via a Userform. I've not
noticed any explanation as to why. Just a simple recommendation.

While I have my own theory as to why Doc Variables may be a better way
to go, I tend to go with the bookmark method. Why? It works for me
and has done in all the project I've worked on (so far).

In the interests of educating myself and possibly others, I'd like to
ask the assembled masses their thoughts.

So...why one method over the other?

Thanks in advance.
Back to top
Login to vote
Doug Robbins - Word MVP

External


Since: Jul 14, 2006
Posts: 5494



(Msg. 2) Posted: Thu Mar 13, 2008 3:15 am
Post subject: Re: Userforms -> Bookmarks Vs Doc Variables [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Another advantage is that data can be retrieved (more reliably) from a
document variable than from a bookmark as the data may be inserted before
the bookmark and not actually be contained within the bookmark.

On the other hand, there are times when a bookmark can be used where a
document variable and DocVariable field does not work so well - inserting
items from a multiline textbox into the cell of a table is one.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Shane" <shane dot herring at gmail dot com> wrote in message
news:2regt3h939vppd8j5b5d55jdbl9ormqh2p@4ax.com...
> Hi.
>
> I've notice a number of times the recommendation to use Doc Variable
> instead of Bookmarks to hold data entered via a Userform. I've not
> noticed any explanation as to why. Just a simple recommendation.
>
> While I have my own theory as to why Doc Variables may be a better way
> to go, I tend to go with the bookmark method. Why? It works for me
> and has done in all the project I've worked on (so far).
>
> In the interests of educating myself and possibly others, I'd like to
> ask the assembled masses their thoughts.
>
> So...why one method over the other?
>
> Thanks in advance.
Back to top
Login to vote
Jay Freedman

External


Since: Sep 16, 2003
Posts: 3946



(Msg. 3) Posted: Thu Mar 13, 2008 3:15 am
Post subject: Re: Userforms -> Bookmarks Vs Doc Variables [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Shane wrote:
> Hi.
>
> I've notice a number of times the recommendation to use Doc Variable
> instead of Bookmarks to hold data entered via a Userform. I've not
> noticed any explanation as to why. Just a simple recommendation.
>
> While I have my own theory as to why Doc Variables may be a better way
> to go, I tend to go with the bookmark method. Why? It works for me
> and has done in all the project I've worked on (so far).
>
> In the interests of educating myself and possibly others, I'd like to
> ask the assembled masses their thoughts.
>
> So...why one method over the other?
>
> Thanks in advance.

Bookmarks are "fragile" -- most people don't turn on the display of
bookmarks, and it's very easy to delete a bookmark while editing text. If
your userform code simply assumes the bookmark exists, it will throw an
error when it tries to insert text at a nonexistent bookmark ("The requested
member of the collection does not exist"). If you have to do a thorough job
of checking for bookmarks, and maybe recreating missing ones, you have quite
a lot of work to do.

When the userform code sets or modifies a document variable, the code
involved is much simpler. In the document, the DocVariable field can be seen
(assuming there's some default value of the variable when the document is
created from the template) so it's less likely to be deleted by mistake. If
someone does delete the field, the only consequence is that the variable's
value doesn't appear where it should.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
Back to top
Login to vote
Jonathan West

External


Since: Dec 18, 2003
Posts: 144



(Msg. 4) Posted: Thu Mar 13, 2008 3:15 am
Post subject: Re: Userforms -> Bookmarks Vs Doc Variables [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Shane" <shane dot herring at gmail dot com> wrote in message
news:2regt3h939vppd8j5b5d55jdbl9ormqh2p@4ax.com...
> Hi.
>
> I've notice a number of times the recommendation to use Doc Variable
> instead of Bookmarks to hold data entered via a Userform. I've not
> noticed any explanation as to why. Just a simple recommendation.
>
> While I have my own theory as to why Doc Variables may be a better way
> to go, I tend to go with the bookmark method. Why? It works for me
> and has done in all the project I've worked on (so far).
>
> In the interests of educating myself and possibly others, I'd like to
> ask the assembled masses their thoughts.
>
> So...why one method over the other?
>
> Thanks in advance.

One further advantage is that with a single docvariable (or docproperty for
that matter) you can have multiple DOCVARIABLE or DOCPROPERTY fields all
pointing to the same property, if you need the same data to be displayed in
different places (e.g. in odd and even page headers)


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Back to top
Login to vote
Display posts from previous:   
       Home -> Office -> User Forms All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
  Office
 Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET