Saleh, a running mate of Afghan President Ashraf Ghani, was slightly injured in the attack.
Afghan forces killed three militants who entered Saleh’s four-storey office after a suicide bomber blew himself up during rush hour, said the interior ministry.
More than 150 civilians were rescued during the six-hour-long operation, said interior ministry spokesman Nasrat Rahimi.
No militant group has claimed responsibility for the attack that came only hours after Ghani and Saleh, along with more than a dozen Afghan politicians, launched their two-month long election campaign.
Presidential polls are expected to be held on Sept.28 but the security situation has been deteriorating across the country with the Taliban and Daesh fighters mounting near-daily attack on Afghan forces, government employees and civilians.