What Arduino? PIn 7 isn't a PWM pin on many of them.
"Failed" is not a very useful description of a problem. What if anything happens?
What type of buzzer? Why use analogWrite()? Passive buzzers normally use the tone() command and active buzzers normally use digitalWrite(). Does your buzzer make any sound with a simple program that just drives it?
Steve