Results 1 to 9 of 9
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    378
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Adding hidden bookmarks (Word 97 (NT))

    Hi

    My macros display a dialog box, collect some information, then store this information as custom properties (for later retrieval by the same macros).

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding hidden bookmarks (Word 97 (NT))

    Would Document Variables work for you? If you're putting then in headers and footers the answer is NO. But elsewhere they work quite well, and the bug about the headers and footers is fixed in 2000 and 2002.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    378
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Adding hidden bookmarks (Word 97 (NT))

    Thanks Kevin. Just what I'm after.

    (I'd never heard of document variables. All this time I've been popping things into document properties. Ah, well, you live and learn.)

    Thanks for your help
    Dale

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding hidden bookmarks (Word 97 (NT))

    Good. Now that I've got you looking in the *right* direction, I'll show you how unbiased I really am:

    Sub AddBookmarkField(strName As String, strText As String)

    strName = "Set " & strName
    Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
    Text:=strName & " """ & strText & """", PreserveFormatting:=False
    End Sub

    ...if you still want to play with "hidden" bookmarks.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    378
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Adding hidden bookmarks (Word 97 (NT))

    Thanks, Kevin. I'll give it a go.

    Off subject
    I use "+" to concatenate, rather than "&".

  6. #6
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding hidden bookmarks (Word 97 (NT))

    Yes, use & to concat strings and + to add numbers. Under some circumstances adding strings could cause a problem. What that problem is, I forget, but people in-the-know will tell you just that.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  7. #7
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding hidden bookmarks (Word 97 (NT))

    If you're concatenating variants which you expect to contain strings, but which have numbers, the numbers will be added rather than concatenated. So it's much safer to concatenate using "&"
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  8. #8
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Adding hidden bookmarks (Word 97 (NT))

    I also started out using "+" to concatenate strings (think it was the influence of the Guy Hart-Davis book).
    So when it was explained to me to use "&" instead, I set about cleaning up my code, including code like this:

    MsgBox Prompt:="This is the prompt", Buttons:=vbExclamation + vbOKOnly

    For the life of me, I couldn't figure out why it didn't work when I used:

    vbExclamation & vbOKOnly

    so after much muttering I changed these back to "+". <img src=/S/hairout.gif border=0 alt=hairout width=31 height=23>
    It was much later that I realized that vbExclamation and vbOKOnly really represent numbers (constants) and you do really want to add them! <img src=/S/doh.gif border=0 alt=doh width=15 height=15>

  9. #9
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding hidden bookmarks (Word 97 (NT))

    Thanks for refreshing the mind on the issue.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Posting Permissions

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