Since your travel is Sweden (EU) -> Denmark (EU) -> Norway (not EU) -> France (EU) -> Switzerland (not EU), there only two possible places (those were you are exiting the EU):
- Before boarding the ferry leaving from Denmark to Norway
- On board the train from France to Switzerland.
Your itinerary is more complex than the usual "I exit the EU and that's it", but I don't think there are are reasons why you couldn't apply at either (though I haven't had the courage to dig into the relevant VAT regulations for details).
Once upon a time there were regular (but not systematic) customs checks on long distance trains from France to Switzerland. I have no recent experience with that, but I wouldn't be surprised if they were close to inexistent nowadays, and at the very least you can hardly count on them, and the alternatives if you don't see a customs officer are complex (you would need to travel back to a manned border post on a road - there are very few of those remaining).
So your best best is probably when leaving Denmark to Norway. You haven't specified which ferry route you are using, but it's likely there is a Danish customs office at the embarcation port. They are listed here, along a number you can call for instructions if there isn't an office at the relevant port.
Make sure you check the conditions of the specific tax refund provider using by the shop you will be purchasing from (especially how/where you can get the actual refund).
Also make sure the office is open at the right hours, and that you budget enough time, customs offices are sometimes quite a bit outside the regular path for private users (for instance in Hirtshals it's actually 3 km from the harbour!), and there could be some waiting in line with truck drivers, especially if a ferry just arrived.
Some countries (like France) offer a service (for a fee, subject to conditions) where you can go to their consulate in your home country to receive the stamp if you couldn't get it on departure. I haven't found an equivalent for Sweden (the service offered by France is applicable only for purchases made in France).
Alternatively, you may ship the goods directly outside the EU. You will need to have relevant documentation, contact the tax refund processor for details.