'Object Required' while using Object Parameter Sub
Hey everyone, I'm getting a 424 error while using the following code:
Code:
Private Sub Command1_Click()
Dim GreenSubject
GreenSubject = InputBox("Green Subject is?") 'Input which object we want to be green
MakeGreen GreenSubject 'Call the green function on the variable GreenSubject
End Sub
Public Sub MakeGreen(ByVal ObjectName As Object)
ObjectName.Backcolor = vbGreen
End Sub
After some research I believe it's something to do with different parameter types. I still can't get it to work though. Any help is very appreciated. :)
Re: 'Object Required' while using Object Parameter Sub
variant
sub is expecting object
probably should change both to string type, input box returns string
unless you send some type of object that has a backcolor property, you will get error trying to set backcolor