How can I make g[]; or h[]; print the same output as f[];? I am trying to capture the output of one function and put it in a document elsewhere, but the CellPrint output is not cooperating.
f[] := Module[{},
Print["Bob"];
CellPrint[Cell["", Background -> Blue, "Print"]];
Print["Bill"]]
printlist = {};
Block[{Print = AppendTo[printlist, {##}] &,
CellPrint = AppendTo[printlist, {##}] &}, f[]];
g[] := Map[CellPrint, ExpressionCell[#, "Print"] & /@
Flatten[printlist, 1]]
h[] := CreateDocument[ExpressionCell[#, "Print"] & /@
Flatten[printlist, 1]]
f[];
g[];



