Your pattern may say that you should use size 6 and 7 needles, but that doesn't mean the gauge will be correct for how you knit, and you're right that if you use a larger or smaller yarn than in the pattern you'll get a different size. There should be a gauge on your pattern, so you should knit a sample to see if you match the sts/inch. If there's too few/inch then use a smaller needle, if there's too many, use a larger needle. And the yarn does have to be the same type to come out the right size.
sue- knitting heretic