Hypersmurf
Moderatarrrrh...
From the PHB [3.0] (page 47) & SRD[3.5] under Rogue description
"Ranged attacks can only count as sneak attacks if the target is within 30 feet."
Yup. You can't sneak attack via flanking with a ranged weapon (since you can't make a melee attack with it), but you can sneak attack an opponent who is denied his Dex bonus for whatever reason, as long as you're within 30 feet, with a ranged weapon or weaponlike spell.
Interestingly, there's no limit on how far away you can be to sneak attack with a melee attack. That means that a Kraken Rogue can sneak attack with his tentacles from 100 feet away... or an Arcane Trickster (or other rogue/caster combo) can sneak attack with a weaponlike touch spell via Spectral Hand - explicitly a melee attack - from the extreme range of the spell.
-Hyp.