Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Bookmark Add-in (Word 2000/SR-1)

    Hi Phil,

    About two years ago I set out to build a non-modal replacement for the built-in Bookmarks dialog. Got about three-quarters done, hit some snags, put it aside and never returned to it.
    If your post here doesn't turn up any alternatives, perhaps I can post it and we can enlist some of the joint VBA expertise present here to fix up some of the missing pieces. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    Gary

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Bookmark Add-in (Word 2000/SR-1)

    <P ID="edit" class=small>(Edited by Phil Rabichow on 02-Mar-03 23:28. to correct modal to non-modal)</P>Does anyone know of a bookmark add-in or utility that would allow you to bring up a non-modal dialog box & enter as many bookmarks as you wanted, alternating between the dialog box & the main document? i.e. the way the Find/Replace dialog box works. Thanks for any ideas.

  3. #3
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bookmark Add-in (Word 2000/SR-1)

    Sounds good to me. I wonder why I haven't seen one advertised?

  4. #4
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bookmark Add-in (Word 2000/SR-1)

    Probably because of the snags that Gary hit. <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>

    It'd be an interesting "group" project that I may be interested in help getting finished.
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  5. #5
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Bookmark Add-in (Word 2000/SR-1)

    Hey Phil

    I can sell you one that makes a bookmark for each heading in the document and assigns the name as the first three letters in each word. <img src=/S/duck.gif border=0 alt=duck width=23 height=23> What else would you want such a beast to do.

    I don't suppose just assigning a macro to add a bookmark to the selected text would do. That one you could get for <img src=/S/free.gif border=0 alt=free width=30 height=15>.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  6. #6
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bookmark Add-in (Word 2000/SR-1)

    No, what I'd like to do is have a dialog box that works similar to the Find/Replace, auto index mark, or spelling boxes. I do have an add-in that lists all your bookmarks on a dropdown toolbar, so I can navigate that way. But the bookmarks dialog box isn't convenient as it only allows you to add one bookmark at a time. I suppose I could write Microsoft's wish-list. I'd certainly be willing to test for a group effort, but I'm afraid I can't add much knowledge in this area. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  7. #7
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Bookmark Add-in (Word 2000/SR-1)

    Well Gary

    We haven't turned over any gems in this thread so far. Can you post what you have developed so we can have a starting point to try to put in the missing pieces?
    Andrew Lockton, Chrysalis Design, Melbourne Australia

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

    Re: Bookmark Add-in (Word 2000/SR-1)

    Gents,

    Just the sort of interest I was hoping to see! <img src=/S/devil.gif border=0 alt=devil width=15 height=15>

    One snag at the moment in posting it: two key bits of code ((i) for sorting the bookmark list by location, (ii) for determine 'non-allowable' characters - this latter one used functions in the Shlwapi) - rely on code which I lifted from articles by Romke Soldaat in the now-departed MS Office and VBA Developer magazine - they're great pieces of code and are free for re-use, but do come with fairly stern copyright warnings against not publishing without permission - which posting here would constitute. While I may try to contact Romke directly, I've no idea whether I would hear back in any near timeframe.

    What I figure to do is substitute non-copyrighted code alternatives for these two functions - there was a thread on 'non-allowable' characters in the VB/VBA forum a few months back, which detailed some good alternative methods - so I can replace that one quickly. As far as the sorting function, perhaps I will just remove the one I've got, and leave that as one of the pieces that need to be filled in. Give me a couple of days, and I will post what's been done so far.

    In addition to being a non-modal equivalent to the built-in Bookmarks dialog, this custom one has some other nice features - in particular, it prompts you if you are creating a new bookmark that has the same name as an existing one. Also, it provides a simple interface to rename an existing bookmark - something you can't do directly with the built-in dialog (instead you have to delete the existing one and add a new one with the new name).

    To whet your appetite, attached is a screen pic of what the Bookmarks Enhanced dialog looks like.

    I really haven't looked at this in a while, but recall a couple of the snags I hit at the time:

    Getting the initial display of bookmarks to sort in the same way that they do in the default dialog.
    Managing the need to refresh the display after changes have been made.

    Will post back in a day or two with a zipped .dot containing this.

    Gary
    Attached Images Attached Images

  9. #9
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Bookmark Add-in (Word 2000/SR-1)

    Gary

    On the sorting the list front, I would suggest you use the WordBasic command described on this MVPS page. The code sample they provided looks like
    <pre>Sub SortTest()
    Dim ss(2) As String
    Dim i As Long

    ss(0) = "orange"
    ss(1) = "apple"
    ss(2) = "banana"
    WordBasic.SortArray ss()

    For i = 0 To 2
    Debug.Print ss(i)
    Next i

    End Sub</pre>

    On the other front, maybe you could place a function in its place as a placeholder and we can come up with the specific code together. There have been some recent threads started by Chris Greaves along a similar line but I would try catching the error when you try to insert the unchecked string as the first quick and dirty solution.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

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

    Re: Bookmark Add-in (Word 2000/SR-1)

    Andrew,

    Thanks for the lead - I was unaware that SortArray would work on a two-dimensional array, but it looks like it does. Hmm, maybe this can be used to substitute for the sorting bit.
    It may take me a couple of days to get a chance to substitute these pieces, and then will post it - stay tuned.....

    Gary

  11. #11
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Bookmark Add-in (Word 2000/SR-1)

    > (ii) for determine 'non-allowable' characters

    This Macro comes from a module of mine that manipulates cross references and bookmarks, it does a "good enough" job

    StuartR


    Private Function StringToBookmarkName(strName As String) As String

    Const strValidChars As String = "0123456789_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijkl mnopqrstuvwxyz"
    Dim i As Integer
    Dim strTemp As String
    Dim strNextChar As String

    For i = 1 To Len(strName)
    strNextChar = Mid(strName, i, 1)
    If InStr(1, strValidChars, strNextChar, vbTextCompare) Then
    strTemp = strTemp & strNextChar
    Else
    strTemp = strTemp & "_"
    End If
    Next i

    StringToBookmarkName = strTemp

    End Function

  12. #12
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Bookmark Add-in (Word 2000/SR-1)

    > Managing the need to refresh the display after changes have been made.

    I gave up on this one and simply provided a "Refresh list" button on the userform!

    StuartR

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

    Re: Bookmark Add-in (Word 2000/SR-1)

    Stuart,

    Thanks muchly - this is the one I recalled seeing on the VBA forum, and intended to go looking for. You're right that this should do fine, save perhaps for the speed issue:

    Where the API function I cribbed from Romke Solaat really excels is that you don't have to loop through the characters in the string individually to compare them to a valid or invalid chars string - instead you just feed the function the bookmark name string and the invalid chars string as parameters, and it returns a True/False as to whether the invalid chars were found in the name string.

    It's likely true that internally the API function is looping through the name string characters, but it runs much faster than a VBA loop.
    Because this function gets called from the 'txtBookmarkName_Change' event procedure, it has to run every time the user types a letter in the textbox, and therefore speed is important - will have to see whether a VBA For loop through the characters will entail a noticeable delay.

    Gary

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

    Re: Bookmark Add-in (Word 2000/SR-1)

    Here's what I ended up with for the 'IsInvalidName' function - this is called from the txtBmkName_Change event procedure:

    <pre>Private Function fIsInvalidName(strName As String) As Boolean

    Const strValidChars As String = "0123456789_ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    Dim i As Long

    'step from end since usually change was made there:
    For i = Len(strName) To 1 Step -1
    If InStr(1, strValidChars, Mid$(strName, i, 1), vbTextCompare) = 0 Then
    fIsInvalidName = True
    Exit For
    End If
    Next 'i

    End Function</pre>

    No problem with the speed - it seems to work quite fast.

    The original article by Romke Soldaat on Shlwapi functions, can be found here; (along with an archive of other articles from the now defunct Office VBA Developer magazine) - interesting reading.

    Gary

  15. #15
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Bookmark Add-in (Word 2000/SR-1)

    One final detail (that I forgot in my earlier post) the first character of a bookmark must be an Alphabetic or an _ character, not a number. So a check is needed to make sure that the string doesn't start with 0-9.

    StuartR

Page 1 of 2 12 LastLast

Posting Permissions

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