I have a userform with a mutipage form on it. There are several "edit" buttons
on each mutipage.
right now, this works
Private Sub BDFB_Edit1_Click()
'Edit information on the datasheet based on the object name
'Test if we are looking at 1-9, or 10 through 40
'We need to know if we want the last two digits of the name
'or just the last one to know what row number to edit.
NameLength = Len(Me.BDFB_Edit1.Name)
RowNumber = Right(Me.BDFB_Edit1.Name, NameLength - 9) ' "BDFB_Edit" is 9
characters
Call BDFBRowEdit(RowNumber)
End Sub
Since this is 1 of 40, I would like the macro to be smart enough to know it
is. I don't want to have to place it's name in the macro if it can figure out
who is already, thus saving me alot of editing on the other 39.
How do I extract the "Edit" button's name with code?
Private Sub BDFB_Edit1_Click()
'Edit information on the datasheet based on the object name
'Test if we are looking at 1-9, or 10 through 40
'We need to know if we want the last two digits of the name
'or just the last one to know what row number to edit.
'not working, looking for the enabled object
MyName = Me.ActiveControl.ControlSource.Name
NameLength = Len(MyName)
RowNumber = Right(MyName, NameLength - 9) ' "BDFB_Edit" is 9 characters
Call BDFBRowEdit(RowNumber)
End Sub