ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get Button Info/Location in when its clicked and pass to macro (https://www.excelbanter.com/excel-programming/394065-get-button-info-location-when-its-clicked-pass-macro.html)

[email protected]

Get Button Info/Location in when its clicked and pass to macro
 

I am working on a small excel application (on excel 2003) where I am
dynamically adding rows from database and adding a button at the end
of each row in a cell using the following:

Dim bttnControl As Button
Set bttnControl = dRaptor.Buttons.Add(iData_Left, iData_Top,
iData_Width, iData_Height)
bttnControl.Text = "Promote"
bttnControl.Name = "Bttn" & iRow
bttnControl.OnAction = "Utility.ButtonCall"

Each button, according to data is assigned with caption/text, a name
and OnAction macro. Using the row number where the button is located
or the name of the button (where I am capturing its row), I will be
extracting data from that row to be updated to the database.

****I want to capture the name of the button or its cell location of
the button clicked and pass it onto the macro function.****

Does anyone know how to?


Jim Thomlinson

Get Button Info/Location in when its clicked and pass to macro
 
Give this a try...

Public Sub ButtonCall
msgbox Application.Caller
end sub
--
HTH...

Jim Thomlinson


" wrote:


I am working on a small excel application (on excel 2003) where I am
dynamically adding rows from database and adding a button at the end
of each row in a cell using the following:

Dim bttnControl As Button
Set bttnControl = dRaptor.Buttons.Add(iData_Left, iData_Top,
iData_Width, iData_Height)
bttnControl.Text = "Promote"
bttnControl.Name = "Bttn" & iRow
bttnControl.OnAction = "Utility.ButtonCall"

Each button, according to data is assigned with caption/text, a name
and OnAction macro. Using the row number where the button is located
or the name of the button (where I am capturing its row), I will be
extracting data from that row to be updated to the database.

****I want to capture the name of the button or its cell location of
the button clicked and pass it onto the macro function.****

Does anyone know how to?



subhavp

Get Button Info/Location in when its clicked and pass to macro
 
That works perfect! thanks Jim

On Jul 24, 5:42 pm, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com wrote:
Give this a try...

Public Sub ButtonCall
msgbox Application.Caller
end sub
--
HTH...

Jim Thomlinson

" wrote:

I am working on a small excel application (on excel 2003) where I am
dynamically adding rows from database and adding a button at the end
of each row in a cell using the following:


Dim bttnControl As Button
Set bttnControl = dRaptor.Buttons.Add(iData_Left, iData_Top,
iData_Width, iData_Height)
bttnControl.Text = "Promote"
bttnControl.Name = "Bttn" & iRow
bttnControl.OnAction = "Utility.ButtonCall"


Each button, according to data is assigned with caption/text, a name
and OnAction macro. Using the row number where the button is located
or the name of the button (where I am capturing its row), I will be
extracting data from that row to be updated to the database.


****I want to capture the name of the button or its cell location of
the button clicked and pass it onto the macro function.****


Does anyone know how to?





All times are GMT +1. The time now is 05:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com