none
Close Project 2010 without saving using VBA RRS feed

  • Question

  • Hi All,

    I have written a code in excel which opens project, runs a macro, and then shuts project. It works fine but it asks if I want to save upon closing. I have tried allsorts to stop it but I have run out of ideas.

    Can you please help?!!!

    Thanks

    Alex

    Dim A As Object
    Set A = CreateObject("MSProject.Application")
        A.Visible = False
        A.Application.DisplayAlerts = False
        A.FileOpen ("My Files.mpp"), ReadOnly:=True
        A.Macro "Save_Temp"
        A.FileClose

    Tuesday, May 19, 2015 12:21 PM

Answers

All replies

  • Hi Alex,

    Do you want to save and close the file? Or just close it without saving?


    Hope this helps,


    Guillaume Rouyre, MBA, MVP, P-Seller |

    Tuesday, May 19, 2015 12:53 PM
    Moderator
  • Have you tried the following code for saving before closing?

    FileClose pjSave

    Or FileClose pjDoNotSave for not saving before closing?


    Hope this helps,


    Guillaume Rouyre, MBA, MVP, P-Seller |

    Tuesday, May 19, 2015 1:02 PM
    Moderator
  • Hi everyone,

    Thanks for the replies!

    I am trying to close without saving.

    With FileClose pjDoNotSave I get an error.....Runtime error 1101 - Argument not valid

    Wednesday, May 20, 2015 8:26 AM
  • After many more tries I have found someting that I think is working!

    A.FileClose False

    Thanks for all you help!

    Alex

    Wednesday, May 20, 2015 8:42 AM