#Ranged attackers don't affect or gain bonuses from flanking.
Ranged attackers don't affect or gain bonuses from flanking.
The flanking rules state:
When making a melee attack, you get a +2 flanking bonus if your opponent is threatened by another enemy character or creature on its opposite border or opposite corner.
And also:
Only a creature or character that threatens the defender can help an attacker get a flanking bonus.
Emphasis mine. So, you have to be making a melee attack and your enemy has to be threatened by one of your allies in order to gain a flanking bonus. The rules on Threatened Squares state:
You threaten all squares into which you can make a melee attack, even when it is not your turn.
Emphasis mine. Thus, you don't threaten the squares that you can target with a ranged attack, and thus can't help someone give a flanking bonus.
There is no place in the flanking rules that talks about a difference between "flanking" and "gaining a flanking bonus". You gain a flanking bonus when you are flanking, and you are flanking when you gain a flanking bonus; the two phrases refer to the same state.
One of the clarifying examples for how flanking works explains this. The situation looks like this:
#OO#
#OO#
####
#S##
#G##
The Os are a Large ogre, with 10 foot reach. The S is a sorcerer, and the G is a goblin. the ogre and goblin are enemies of the sorcerer.
3: The goblin and the ogre flank the sorcerer, as they can draw a line between them that passes through opposite sides of the sorcerer's square. If the ogre didn't have reach to the sorcerer, though, he and the goblin would not be flanking her.
As this line says, the only way that the ogre and goblin can flank the sorcerer is if both of them can reach the sorcerer. Thus, you need to be able to threaten a character in order to flank them.
The only exception to the rule that you can't flank with a ranged weapon is the case where you threaten squares with a ranged weapon, like if you have Snap Shot or Improved Snap Shot. If you have such a feat, then you can help someone else flank, but since you aren't using a melee weapon, you cannot flank someone yourself.
You can also flank while wielding a ranged weapon if you have Improved Unarmed Strike, which lets you make melee attacks with your hands full. This doesn't let you get a flanking bonus with your ranged attacks, though.