Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello gurus
In Document settings and triggers one can create a trigger for OnAnySelect. Meaning any object selected/touched will trigger an event/action.
Is it possible to send the Object's ID (or name) to a macro if a macro is set to run on the trigger?
For instance, if a table's ID is TB01 and a user selects a record in the table, I would like the trigger to send to a macro that TB01 was activated.
Is that possible?
Thanks
Josh
This script should return the object id of the active object on the active sheet:
set s=ActiveDocument.ActiveSheet
objs=s.GetSheetObjects
for i=lbound(objs) to ubound(objs)
if objs(i).IsActive then
id = obj(i).GetObjectId
msgbox("ID = " & id)
end if
next
I don't believe that OnAnySelect will trigger when an object is selected. I think it is triggered when a selection is made in any field.
Thanks.
That is what I meant. If a field is selected -- say Name of a SalesPerson in the table, a trigger is fired. I know that for a fact as I have created such an event/action.
However, I would like to send to the macro the name of the table from which the event was triggered.
Is that possible?
Like ActiveDocument.ActiveObject(name) Is there such a thing as "ActiveObject(name)" or any way to pass the object's name.
Thanks
This script should return the object id of the active object on the active sheet:
set s=ActiveDocument.ActiveSheet
objs=s.GetSheetObjects
for i=lbound(objs) to ubound(objs)
if objs(i).IsActive then
id = obj(i).GetObjectId
msgbox("ID = " & id)
end if
next
Wonderful!
Exactly what I was looking for!
You are it!!
Much obliged.
DID NOT WORK UNTIL...
It took me some long moments of frustration to find the error in your code 😆
set s=ActiveDocument.ActiveSheet
objs=s.GetSheetObjects
for i=lbound(objs) to ubound(objs)
if objs(i).IsActive then
id = obj(i).GetObjectId
msgbox("ID = " & id)
end if
next
SHOULD BE
set s=ActiveDocument.ActiveSheet
objs=s.GetSheetObjects
for i=lbound(objs) to ubound(objs)
if objs(i).IsActive then
id = objS(i).GetObjectId
msgbox("ID = " & id)
end if
next
And then it works.
Once again thank you