Just wanted to share this little function for upping rev letter.
I created it as part of my attempt to automate much of our ECRN process and thought it might be useful to others.
I find it pretty handy, such as with a RevisionTableAnnotation object you can use it like:
<p><span style="font-family: Consolas;">REVTABLE.AddRevision (NextLetter(REVISION))</span></p>
EDIT: I updated code to fix a problem with transitioning from AAY to ABA.
EDIT 2: I posted for peer review on CodeReview and received a much simpler method of doing this, so I've edited the code to this simplified version.
Link: vba - Next revision letter - Code Review Stack Exchange
<p>Option Explicit</p><p>'***NOTE: _</p><p> This module requires the following references: _</p><p> <NONE></p><p> </p><p></p><p></p><p>Public Function NextRevLetter(currentRev As String) As String</p><p> ' Alphabet, skipping I O Q S X Z</p><p> Const alphabet As String = "ABCDEFGHJKLMNPRTUVWY"</p><p> Dim i As Long</p><p> Dim digit As String</p><p> </p><p> NextRevLetter = currentRev</p><p> For i = Len(NextRevLetter) To 1 Step -1</p><p> digit = Mid\\\$(NextRevLetter, i, 1)</p><p> </p><p> ' Increment digit: "A"->"B", "B"->"C", ..., "H"->"J", ..., "Y"->"".</p><p> ' Any other garbage maps to "A".</p><p> digit = Mid\\\$(alphabet, InStr(alphabet, digit) + 1, 1)</p><p> </p><p> If Len(digit) = 0 Then</p><p> ' "Y"->"" case. Reset to "A", then carry.</p><p> Mid\\\$(NextRevLetter, i, 1) = "A"</p><p> Else</p><p> Mid\\\$(NextRevLetter, i, 1) = digit</p><p> Exit Function</p><p> End If</p><p> Next</p><p> ' Carry.</p><p> NextRevLetter = "A" & NextRevLetter</p><p>End Function</p>
Message was edited by: Steve Soeder
SolidworksApi macros