PDA

View Full Version : generate a serial unique ID whenever a new document is created.



amerc
06-01-2008, 08:59 AM
I need to generate a serial unique ID whenever a new document is created. Let's say a text field with numbers that is incremented every time.:dunno

lucas
06-01-2008, 10:15 AM
If you had searched the knowledgebase you might have found this:
http://vbaexpress.com/kb/getarticle.php?kb_id=56

amerc
06-01-2008, 05:40 PM
If you had searched the knowledgebase you might have found this:... link...

Ya .. I did after I posted the question .. and I found it .. Thanks a lot.:thumb

amerc
06-01-2008, 06:41 PM
I could not run the code ... there is a message saying that the reference refes to a protected area of the document ... (I am using OS X .. and I changed the path properly) ... The template is saved somewhere in the applications Folder and the text file .. was on Desktop.
at this line :
ActiveDocument.Bookmarks("oNum").Range.InsertBefore Format(oNum, "00#") Why is that ?

amerc
06-01-2008, 09:14 PM
I resolved it .. I used another method for opening files .. on OS X :
Open Filename$ For Input As #FileHandle
works better than the way in the link above.
Thanks