The Greeks took over near the end (~0BC) — the pyramids were ancient by then.
Actually, Macedonian armies (who were Greek) under Alexander the Great conquered Egypt around 320 B.C. Alex was crowned Pharaoh, and thus began the last, Greek, dynasty.