Hi all
I've been struggling with this for while now and i hope you can help..
I am trying to pass 3 parameters thru a button's .onaction property to a macro.
(Can't belive Microsoft made it this difficult!!)
My macro is like this:
----------------------------------------------------------
Sub test()
'Creates a button at cell A1
Cells(1, 1).Select
Row = ActiveCell.Row
Column = ActiveCell.Column
ID = "123-AA-123"
Dim btn1 As Object
Set btn1 = ActiveSheet.Buttons.Add(ActiveCell.Left, ActiveCell.Top, ActiveCell.Width, ActiveCell.Height)
With btn1
.Caption = "Check"
.OnAction = "'check ""row"", ""column"",""ID"" '" 'this is where the problem is..
End With
End Sub
Sub check(r, c, i)
'Recieves values from the button's .OnAction property
MsgBox "Button " & i & " is at row=" & r & ", column=" & c
End Sub
-----------------------------------------------------------
What happens is of course that no values are passed over - Only the name of the variables..
Anyone got any ideas on how i can pass the values over?
thanks in advance
I've been struggling with this for while now and i hope you can help..
I am trying to pass 3 parameters thru a button's .onaction property to a macro.
(Can't belive Microsoft made it this difficult!!)
My macro is like this:
----------------------------------------------------------
Sub test()
'Creates a button at cell A1
Cells(1, 1).Select
Row = ActiveCell.Row
Column = ActiveCell.Column
ID = "123-AA-123"
Dim btn1 As Object
Set btn1 = ActiveSheet.Buttons.Add(ActiveCell.Left, ActiveCell.Top, ActiveCell.Width, ActiveCell.Height)
With btn1
.Caption = "Check"
.OnAction = "'check ""row"", ""column"",""ID"" '" 'this is where the problem is..
End With
End Sub
Sub check(r, c, i)
'Recieves values from the button's .OnAction property
MsgBox "Button " & i & " is at row=" & r & ", column=" & c
End Sub
-----------------------------------------------------------
What happens is of course that no values are passed over - Only the name of the variables..
Anyone got any ideas on how i can pass the values over?
thanks in advance