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 36 weeks ago
6 years 22 weeks ago
6 years 34 weeks ago
6 years 37 weeks ago
6 years 38 weeks ago
6 years 43 weeks ago
6 years 52 weeks ago
7 years 2 days ago
7 years 3 days ago
7 years 3 days ago