I wouldn't allow such shenanigans. Not without some custom Talent, at least.
Huh, custom Talent...
Prerequisites: Basic Weapon Training (Any), Hip Shooting, BS 35, Agi 35
Most imperial regiments are trained to stop shooting when the enemy gets too close, switching to their combat knives or bayonets. Some squads with greater propensity for close combat, though, refuse to abandon their trusty rifles for such a trivial reason as an enemy engaging them with a chainsword.
Characters possessing this Talent can use their Basic class ranged weapons for shooting enemies currently engaged in melee with them.
Trench Warfare Training
Prerequisites: Basic Weapon Training (Any), Melee Weapon Training (Primitive), WS 30
Not all Imperial Regiments are issued bayonet attachments to their rifles - after all, their superior training with best quality armaments issued by the Departmento Munitorum should preclude the enemies of the God-Emperor from ever advancing close enough. Some seasoned Guardsmen learn that the unthinkable does happen some times, and they compensate by training to defend themselves using the bulk of their trusty gun.
Upon learning this Talent, the character can treat his Basic class ranged weapon as a Melee weapon dealing d10 Impact damage with the Primitive* and Defensive qualities. Should a character who has this talent utilize a weapon with a Melee Attachment upgrade, he can decide which melee profile to use at the start of each of his Turns.
Shoot and Stab
Prerequisites: Two Weapon Wielder (Ballistic and Melee), Eat this!, Trench Warfare Training, WS 35
True specialists in trench warfare don't treat the shooting and stabbing ends of their rifle as separate weapons, but rather as one versatile tool of destruction.
Whenever equipped with a Basic ranged weapon with a bayonet attachment, the character can make both melee and ranged attacks on the same Turn, subject to all rules of two weapon fighting.
* For BC rules users, the Primitive trait of this weapon has a value of 6.