For the first digit there are 7 choices. For the second digit there are 6 choices (because we can't use the same one again). And so on, until there is only one choice for the last digit.
The number of possible codes is this: 7*6*5*4*3*2*1 = 7! = 5040