1. Only 15 Canadian Airports have US Customs/Border Patrol PreClearance.
2. YUL is one of them

.
3. Now that you're NOT clearing customs at DTW, you get to unload at either the B or C gates

.
4. 45 minutes is enough time, IF your inbound flight is ON TIME (late is bad, early is also bad, early means the gate your pilot wants is currently occupied and while driving in circles waiting for them to leave, he COULD get lost.......).
5. Enjoy the tunnel, enjoy the tunnel, enj.... GET OUT OF THE TUNNEL!!! (Please note the lovely water feature on your left as you exit the tunnel....)
6. Note the Tram board and your departure gate, you are now in the exact middle of a 1 mile terminal. If your gate is near here, YOU WIN! Otherwise, Go upstairs to the Tram. There are 3 stops, near that end, here in the middle, and near the other end. The lovely Tram boards tell you when to use the tram, and which way to go!
7. Delta has recently started to pay attention to the FAA's on-time ratings. They will occasionally (see: friggin' at random) close the doors at 15 minutes prior to departure (read the sign on every gate's desk). Yes, they will move you, for free, onto the next AVAILABLE flight, but it ain't a lot of fun...... you might want to skip the coffee stop and get to the gate ASAP.
May your trip be blessed and PRAY you never have to change airlines in Detroit, THAT is an experience we shall not wish upon a friend.......