Calling Code from Module and Pasting into Current code?
This should be simple but I don't know if it "works" the way I think I want it to work.
Say I had a block of code like
Public Sub TextBoxBorderColor_Afterupdate()
Dim MyColor As Long
Dim oCtrl As Control
Select Case TextBoxBorderColor.Text
Call ColorCall 'I WANT TO PULL CODE FROM MODULE AND HAVE IT "PASTED" HERE - This isn't working it is expecting First case
Case Else: Exit Sub
End Select
For Each oCtrl In Me.Controls
If TypeName(oCtrl) = "TextBox" Or TypeName(oCtrl) = "Label" Or TypeName(oCtrl) = "Image" Then
If oCtrl.Tag <> "RouteButtons" Then
oCtrl.BorderColor = MyColor
End If
End If
Next oCtrl
Worksheets("Options").Range("A4").Value = TextBoxBorderColor.Value
End Sub
I want to paste some code in a module that will be used many times so I put it in a module like
Public Sub ColorCall()
Case "0": MyColor = RGB(255, 255, 255)
Case "56": MyColor = RGB(51, 51, 51)
End Sub
The code above is what I tried but when it gets to "Call ColorCall" I get an error because it expects the first case...
Is there a way to do this?
Recent comments
5 years 41 weeks ago
6 years 27 weeks ago
6 years 39 weeks ago
6 years 42 weeks ago
6 years 43 weeks ago
6 years 48 weeks ago
7 years 4 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago