There is a promissing new function EvaluationBox[] and a nice last example in documentation section for it:
Button["date", NotebookWrite[EvaluationBox[], ToBoxes @ DateString[]]]
(Click)
The problem is that this string is in an "Input" cell now! Why was it converted?
Quite a problem because it is not easy to change cell style.
I was trying:
Button["date", NotebookWrite[EvaluationBox[],
Cell[#, "Output"] & @ BoxData @ ToBoxes @ DateString[]]]
but the problem remains. On the other hand we can see that it is not a problem of NotebookWrite itself but of EvaluationBox[] because EvaluationCell replaced by the code above gives correct output:
Button["date", NotebookWrite[EvaluationCell[],
Cell[#, "Output"] & @ BoxData @ ToBoxes @ DateString[]]]
Any thougts? Quick work arounds?
I've introduced one, ugly but working here: Getting the Box of a Button . I was trying to improve it with EvluationBox[] but the I've faced this issue.


EvaluationBoxis going to create a cell no matter what, and you don't want a cell. If you did, sacratus' answer would serve you. But because you want a box structure to insert into a possibly much larger expression, I thinkEvaluationBoxis simply inappropriate for the purpose you have in mind. Therefore, I would not call what you have encountered a bug. – m_goldberg Mar 27 '15 at 22:02EvaluationBoxhas the side effect of deleting the output cell containing the button and then creating a new cell in your notebook. – m_goldberg Mar 27 '15 at 22:10"EvaluationBox[] returns a BoxObject corresponding to the box structure in which this function is being evaluated."– Kuba Mar 27 '15 at 22:13EvaluationBoxis very poor and looks to be hastily written. I think you have a good case for complaining to WRI about the documentation. – m_goldberg Mar 27 '15 at 22:15