I have just spent a delightful 11 minutes listening to this short lecture on the Schola Gladiatoria Youtube channel. The subject was why the use of bladed weapons was extremely important for centuries after gunpowder weapons were invented.
For the record, I agree with everything he says. This is doubtless why I found the video so interesting!
The most important reason is: No reloading time.
It takes me a few minutes to reload my Walker in calm conditions on a table. I expect that in combat it would effectively be impossible.
“If a bullet hit you, it was often more fatal than a bayonet stab or a sword wound.”
When I reached this statement I kind of was shocked. This depends enormously on the era, because the firearms changed quite a lot.
During the 30 Years War, it was simply false. The guns were terrible and inaccurate and had lousy range. You could die from a gunshot wound, of course, but a stab wound was far more likely to kill you. (Which is why the pike block was the main force in a standard infantry regiment, not the shot sleeves.)
During the Napoleonic Wars, I would say it was about even. The weapons had improved substantially, but it was still smooth-bore muskets firing spherical balls.
By the Crimean war, with the adoption of the Minie ball and rifled muskets, fire had become immensely lethal. And that was even more true during the American Civil War, which is why the rare cases of bayonet charges in the Civil War are generally noteworthy. They did happen, but it was often a desperation move (e.g. the 20th Maine at Little Round Top in the Battle of Gettysburg).