This is true in the 17th century, when the Three Musketeers stories take place. Towards the end of the 17th century though, folks started sticking pointy things (called bayonets) on the end of their muskets, which allowed the musket to serve a dual role as both a ranged weapon and a pike-like close combat weapon. This allowed the army to carry fewer weapons, since soldiers now did not need a separate weapon for fighting up close, and it allowed for more efficient distribution of weapons since before this they would dedicate soldiers as pikemen to protect the musketeers. Once they switched to bayonets, they no longer needed dedicated pikemen, so everyone could be a musketeer, and everyone could fight at both long range and close up.
Muskets back in those days were effective only in large groups. You really didn’t want to use one for single one on one style combat. Smooth bore muskets were only accurate to about 50 to 100 yards. It used to be said that you could stand 200 yards from a single musketeer and not fear being shot by him, which was a bit of an exaggeration because you never know, he could get lucky. Smooth bore muskets fire curve balls. The round ball is going to randomly strike one side of the barrel as it exits and it’s going to spin. After about a hundred yards, it’s anyone’s guess as to which way it’s going to go.
It takes 15 to 20 seconds to load a musket, and running 100 yards in 20 seconds does not require anything close to Olympic style athletic ability (a high school athlete can do it in about half that time). So, as Chronos said, you are going to be lucky to get more than one shot off before the enemy closes. If you don’t have a bayonet on the end of your musket, it’s time to drop the musket and draw the sword.
Duels were fought with pistols or swords.