Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / December 2004

Tip: Looking for answers? Try searching our database.

How to create random names or numbers for bookmark names

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marcel - 13 Dec 2004 13:31 GMT
Hi,

Does someone know of a kind of randomize function to create unique names for
bookmarks. If I merge or add documents to each other the bookmarks in these
documents must not be "overwritten" by bookmarks with the same name from the
document that is added.

Regards,

Marcel
Peter - 13 Dec 2004 17:01 GMT
You could use a GUID to name each bookmark.  Naturally, you'll need some way to keep track of the bookmark names.  Perhaps Document Variables would be suitable for that.

' creates a GUID, and passes it to the calling entity
Function getGUID() As String
 Dim myTypeLib As Object
 Dim strg As String
 Set myTypeLib = CreateObject("Scriptlet.Typelib")
 ' Want to chop off the opening and closing brackets, as well as 2 non-printable characters at the end of the string.
 strg = myTypeLib.GUID
 getGUID = Mid(strg, 2, Len(strg) - 4)
 Set myTypeLib = Nothing
End Function

hth,

-Peter

> Hi,
>
[quoted text clipped - 6 lines]
>
> Marcel
Marcel - 13 Dec 2004 19:09 GMT
Hi Peter,

I tested your code and it generates a nice global identifier. Very usefull
to me. I have to strip the dashes and every name should start with an letter
from A-Z. Yes, I'll have to manage the bookmark names but by using document
variables won't work. Doc variables are local to each document and
dissappear after insert. I'll find something to manage that.

Thanks,

Marcel

You could use a GUID to name each bookmark.  Naturally, you'll need some way
to keep track of the bookmark names.  Perhaps Document Variables would be
suitable for that.

' creates a GUID, and passes it to the calling entity
Function getGUID() As String
 Dim myTypeLib As Object
 Dim strg As String
 Set myTypeLib = CreateObject("Scriptlet.Typelib")
 ' Want to chop off the opening and closing brackets, as well as 2
non-printable characters at the end of the string.
 strg = myTypeLib.GUID
 getGUID = Mid(strg, 2, Len(strg) - 4)
 Set myTypeLib = Nothing
End Function

hth,

-Peter

> Hi,
>
[quoted text clipped - 9 lines]
>
> Marcel

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.