Search code examples
vbaexceldialogms-project

VBA Code to Bypass Dialog Box


I have some code in VBA that opens up a Microsoft Project file, pulls some data, and then closes the file. Unfortunately, I have added some links to the Project file that now makes it so some Splash Screens pop up when opened. I'm trying to edit my code so that the code closes the Splash Screens for the user running the macro so that they don't see or have to respond to them and the macro continues through the process automatically.

This is the code the way it is currently written (FileToOpen is set as the file location)

'Open the MSProject file
        Set mpApp = New MSProject.Application
        mpApp.Visible = True
        AppActivate "Microsoft Project"
        mpApp.FileOpen FileToOpen

Then it gathers the data and closes the file

'Close Project and select Excel as running program
    mpApp.FileClose pjDoNotSave
    mpApp.Quit
    Set mpApp = Nothing

There are the splash screens I need to navigate through, clicking either OK or Cancel here:

1st dialog box

Clicking Close here (not all other options may always be greyed out):

2nd dialog box

Any help would be greatly appreciated!!

Thanks!


Solution

  • I would try this:

    mpApp.FileOpen Name:=file_location_and_name, ReadOnly:=True, openPool:=pjDoNotOpenPool
    

    This is query I searched: open resources pool information dialog vba. I would try the same search for the other dialog if the problem persists after you apply the 1st fix.

    HTH