whateveragain
Programmer
How can I reuse code without using code snippets or cutting and pasting. I was hoping that I could use some sort of class, but it seems that classes are meant for the entire page or a portion of the page. I don't want to use snippets because if a change is needed, I'll need to go to each page that I placed the snippet. If possible I'd like to be able to change the code in one place. An example of the type of code I want to duplicate is as follows:
Sub getrank()
Dim Rank2 As String
Dim selections As String
Dim wholestring As String
Dim lno2 As Integer
Dim whole2string As String
whole2string = Session("selections")
selections = Session("Selections")
lno2 = InStr(1, Session("Selections"), "Rank2")
If lno2 = 0 Then
lno2 = InStr(1, Session("Selections"), "Rank2")
End If
lno2 = lno2 + 1
whole2string = Session("Selections") & Space(1)
rank2 = whole2string.Substring(lno2 + 26, 1)
End Sub
Sub getrank()
Dim Rank2 As String
Dim selections As String
Dim wholestring As String
Dim lno2 As Integer
Dim whole2string As String
whole2string = Session("selections")
selections = Session("Selections")
lno2 = InStr(1, Session("Selections"), "Rank2")
If lno2 = 0 Then
lno2 = InStr(1, Session("Selections"), "Rank2")
End If
lno2 = lno2 + 1
whole2string = Session("Selections") & Space(1)
rank2 = whole2string.Substring(lno2 + 26, 1)
End Sub