|
Visual Basic (VB and VBA) |
|
Copyright 1999-2001 Christopher Greaves. All rights reserved. Home Page and email to [email protected] |
| If in doubt, record a macro and inspect the entrails! |
Please read the DISCLAIMER.
Here is an INDEX to all the procedures.
You will probably need one copy of my GLOBAL DECLARATIONS.
Public Function intDocumentSequence(strIdentifier As String, intIncrement As Integer) As Integer
' Procedure : intDocumentSequence
' Description: Return a unique ascending sequence number from the current document.
' Copyright: Chris Greaves Inc.
' Inputs: String key, Integer default initial value.
' Returns: INTEGER.
' Assumes: None.
' Side Effects: The document propoerties will change.
' Tested: By the calls below.
Dim intSeq As Integer
' Obtain the next available value of an internal sequence,
Dim lngIndex As Long
lngIndex = lngIndexCustomDocumentProperties(ActiveDocument.Name, strIdentifier)
If lngIndex < 0 Then
intSeq = 1
lngIndex = lngAddCustomDocumentProperties(ActiveDocument.Name, strIdentifier)
Else
intSeq = Val(ActiveDocument.CustomDocumentProperties(lngIndex)) + intIncrement
End If
ActiveDocument.CustomDocumentProperties(lngIndex).Value = str(intSeq)
intDocumentSequence = intSeq
'Sub TESTintDocumentSequence()
' MsgBox intDocumentSequence("Sequence", 1)
' MsgBox intDocumentSequence("Sequence", 1)
' MsgBox intDocumentSequence("Sequence", 1)
' MsgBox intDocumentSequence("NewSequence", 1)
' MsgBox intDocumentSequence("NewSequence", 1)
'End Sub
End Function
| We all knew nothing when we started … |
|
Home Page and Contact Information Send email to [email protected]. This page was last updated Thursday, November 15, 2001 |