({{, (RefLink[SetSelectedNotebook, paclet:ref/SetSelectedNotebook])[obj]
makes the notebook corresponding to obj be the currently selected one in the front end.}})

OpenersNotesSection(Spacer1)Details

obj can be a (RefLink[NotebookObject, paclet:ref/NotebookObject]) or (RefLink[CellObject, paclet:ref/CellObject]). If obj is a (RefLink[CellObject, paclet:ref/CellObject]), then the notebook containing obj will be selected.

Setting a particular notebook to be the currently selected one typically makes it the top notebook displayed on the screen.

Making a notebook the currently selected one does not affect the current selection within that notebook, or within other notebooks.

OpenersPrimaryExamplesSection(Spacer1)Examples  (3)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Create two notebook documents:

nb1=CreateDocument[{a,b,c},WindowTitle->"First"];
nb2=CreateDocument[{1,2,3},WindowTitle->"Second"];
SelectedNotebook[]

Make the first one the selected notebook:

SetSelectedNotebook[nb1]

OpenersExampleSection1(Spacer1)Applications  (1)

Create a palette for selecting from two existing notebook windows:

nb1=CreateDocument[{a,b,c},WindowTitle->"First"];
nb2=CreateDocument[{1,2,3},WindowTitle->"Second"];

PaletteNotebook[{Button["Select 1",SetSelectedNotebook[nb1]],Button["Select 2",SetSelectedNotebook[nb2]]}]

OpenersExampleSection2(Spacer1)Properties & Relations  (1)

(RefLink[SelectedNotebook, paclet:ref/SelectedNotebook]) gives you the notebook object for the selected notebook:

nb=CreateDocument[{a,b,c}]

SetSelectedNotebook[nb];
SelectedNotebook[]

The evaluation notebook can be different from the currently selected notebook:

SetSelectedNotebook[nb];
{SelectedNotebook[],EvaluationNotebook[]}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[SelectedNotebook, paclet:ref/SelectedNotebook])  ▪  (RefLink[Notebooks, paclet:ref/Notebooks])  ▪  (RefLink[WindowClickSelect, paclet:ref/WindowClickSelect])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Notebooks from the Kernel, paclet:tutorial/ManipulatingNotebooksFromTheKernel])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Low-Level Notebook Programming, paclet:guide/LowLevelNotebookProgramming])}})}})