End macro with open file window

I want my macro to end after the open file window/dialog box is opened.

SendKeys "^o"

This does not work when I play it from the VB for applications but when I start the script form SolidWorks it works.

SolidworksApi macros