This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

ButtonNotebook

ButtonNotebook
gives the notebook, if any, that contains the button which initiated the current evaluation.
Make a button that sets to the NotebookObject for the button's notebook:
After the button is clicked, the variable is assigned:
Use the object for further processing:
Make a button that sets to the NotebookObject for the button's notebook:
In[1]:=
Click for copyable input
Out[1]=
After the button is clicked, the variable is assigned:
In[2]:=
Click for copyable input
Out[2]=
Use the object for further processing:
In[3]:=
Click for copyable input
Out[3]=
Create a palette button that writes to the input notebook and then closes the palette:
The button notebook is sometimes not the same as the current input notebook:
After clicking the button, these two notebooks are different:
New in 3