+ Reply to Thread
Results 1 to 5 of 5

Inserting multiple bookmarks

  1. #1
    Valued Forum Contributor
    Join Date
    11-16-2004
    Location
    Devon UK
    MS-Off Ver
    2010
    Posts
    357

    Inserting multiple bookmarks

    I'm new to VBA in word though have done a bit in excel. I have what I think will be a simple issue. In a document I want to autocomplete a number of fields from strings gathered from a userform and stored in variables. I can achieve this by using:
    Please Login or Register  to view this content.
    However I can only create a single bookmark called "name" in the document if I want to insert this same text in multiple places in the document how can I do this?
    Last edited by tryer; 02-15-2012 at 04:29 PM.

  2. #2
    Forum Guru macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,703

    Re: Inserting multiple bookmarks

    Hi tryer,

    I'd suggest using a custom document property instead of a bookmark, because bookmarks are all too easily deleted by accident. If you create a custom document property named 'MyProp' (with, say, a space as the default value), then you can update that property with your code and have DOCPROPERTY fields, coded as {DOCPROPERTY MyProp} wherever you need them in the document to replicate the value. The code to do this might look like:
    Please Login or Register  to view this content.
    Note: The field brace pairs (ie '{ }') for the DOCPROPERTY field example are created via Ctrl-F9 - you can't simply type them or copy & paste them from this message.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Valued Forum Contributor
    Join Date
    11-16-2004
    Location
    Devon UK
    MS-Off Ver
    2010
    Posts
    357

    Re: Inserting multiple bookmarks

    Hi Paul,

    Thanks for the help. unfortunately I can't get this to work, I have copied your suggeted code exactly and created the docpropert by using Ctrl+F9 then typing DOCPROPERTY myprop but when I run it I get the error:Invalid procedure call or argument
    I'm sure the problem is that I just typed in the docproperty however when I use Insert>Docproperty I have a number of choices (starting with author) but custom is not among them

  4. #4
    Forum Guru macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,703

    Re: Inserting multiple bookmarks

    Hi tryer,

    The property must be created before you can use it. To create the custom property, go to File|Properties|Advanced > Custom

  5. #5
    Valued Forum Contributor
    Join Date
    11-16-2004
    Location
    Devon UK
    MS-Off Ver
    2010
    Posts
    357

    Re: Inserting multiple bookmarks

    Ah thank you

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1