SaveAs4 should not prompt the save dialog, it should just save instead. What the values of nErrors, nWarnings after the method is invoked? Make sure that you do not have any invalid characters in your path. I would also suggest to switch to ModelDocExtension::SaveAs method instead of IModelDoc2::SaveAs4 unless you are using SolidWorks older than 2007.
Regards, Artem Taturevych | Snr. Developer | IC3D ANZ
IC3DSteel – New Steel Solution for SolidWorks