We did the Baltic with Star Princess a couple of years ago. Tallin & Oslo are very easy, Oslo the berth is right in the centre of the city by the castle and Tallin it's only about 25mins walk from the centre but there are shuttle buses anyway. Helsinki there are shuttle buses too. Gdansk and Stockholm are less accessible, because you don't actually berth in either city. For Gdansk you dock at Gdynia and for Stockholm you're at a location I can't remember the name of but I think it was about an hour away. The ship moored in a bay and transfer was by tender. We went on tours in Gdansk and Stockholm so didn't use the public transport, but I'm sure you can get to Stockholm by train.
See Stockholm Journey Planner - http://reseplanerare.sl.se - type From: Nynäshamn To: Vasamuseet (Nynäshamn is the pier port)