Though I've never replaced one, I am 99.99999% sure that the refrigerant needs to be removed before the switch can be replaced. I know of no other way for the switch to detect the pressure in the refrigerant line if it is not plumbed directly into the line.
You can replace the switch yourself but a shop should be used to recover the refrigerant so that it doesn't escape into the atmosphere.
Looks like my high pressure switch on the A/C high pressure line of my Corolla 1994 has to be replace. Electricity doesn’t get to the compressor because this faulty switch told me the dealer. Can I buy the switch and replace it myself ? Can it be replace without taking out the R134A A/C gas? Thanks for your advice