Look for Star Trek: The New Voyages; the story you want is "Visit to a Weird Planet Revisited"
Shatner nodded, and they each took one of Nimoy’s arms, prepared to
hustle him out into the corridor. By this time, however, he too had
counted up the costs of scene design and construction. James Doohan
could have gone on improvising in the tones of outraged Scottishness
all day without breaking, but Matt Jeffries just didn’t have the
budget to have built the room they were in.
The door swooshed open at their approach, and all three knew, even
before they got past it, that they were on board the Enterprise. The
pneumatic door-sound was supposed to be added by Glen Glenn Sound.
They had never before heard it in real life. The door swooshed shut
behind them, and they stood still for a moment, feeling totally lost.
“Nice going, De,” said Shatner, trying to recover some poise. “Now,
how the hell do we find the Sickbay?”
“Go to the elevator and say ‘Sickbay’?” suggested Kelley.