I am creating a blank worksheet with various procedures that automates another application (AccuTerm Terminal).
My issue is that I am wanting to add a line to each ActiveX Command Button that will resize the button to a range.
For example, let's say I have this command button:
The `setButtonSize` is the procedure that is suppose to be setting the size of the button to the size of the cell: `Me.Range("B2")`.
The method in `setButtonSize` is:
But `.Caller` doesn't appear to want to work, as I am getting an Object Required error. Of course, I could add these lines of code to each button:
It is my preference not to do this.
So, how would I be able to send the `CommandButtonX` obj to the `setButtonSize` routine?
Thanks!
My issue is that I am wanting to add a line to each ActiveX Command Button that will resize the button to a range.
For example, let's say I have this command button:
Code:
Private Sub CommandButton2_Click()
setButtonSize Me.Range("B2")
GrabTriggerReports
End Sub
The `setButtonSize` is the procedure that is suppose to be setting the size of the button to the size of the cell: `Me.Range("B2")`.
The method in `setButtonSize` is:
Code:
Sub setButtonSize(rng As Range)
With Application.Caller
.Left = rng.Left
.Top = rng.Top
.Width = rng.Width
.Height = rng.Height
End With
End Sub
But `.Caller` doesn't appear to want to work, as I am getting an Object Required error. Of course, I could add these lines of code to each button:
Code:
With CommandButton2
.Left = rng.Left
.Top = rng.Top
.Width = rng.Width
.Height = rng.Height
End With
It is my preference not to do this.
So, how would I be able to send the `CommandButtonX` obj to the `setButtonSize` routine?
Thanks!