VBA Project File Sharing and Project Check Out

Pascal Idez [MCP] 1 Reputation point
2021-01-17T21:45:21.67+00:00

Sorry, I'm not sure whether I'm at the right place for asking this question, but I'm turning around anf around to find an answer to this simple question:

  1. I got my project file from Project Server
  2. I export the project using the save for sharing method
  3. I try to save it to the project server back
  4. Got an error message telling me the project is already checked out (to my name)
  5. I actually see the project being checked out when the FileOpenEx statement is executed
       ' Ouvre le projet qui est sur le serveur
        prjApp.FileOpenEx Name:="<>\Médias sociaux", ReadOnly:=False
    
        Set openProjects = prjApp.Projects
    
        For Each proj In openProjects
            If proj.Name = "Médias sociaux" Then
                If Not proj.Type = pjProjectTypeEnterpriseCheckedOut Then
                    proj.CheckoutProject
                End If
                If proj.Type = pjProjectTypeEnterpriseCheckedOut Then
    
                    ' Le projet a été verrouillé, sauvegarde locale pour manipulation des chiffres
                    tempFolder = objFileSystem.GetSpecialFolder(2)
                    prjApp.SaveForSharing Filename:=tempFolder & "\" & proj.Name
                    fait = 0
    
                    ' Sauve le fichier et le publie
                    prjApp.FileSaveAs Name:="<>\Médias sociaux", FormatID:="MSProject.mpp"
                    prjApp.FileCloseEx pjDoNotSave, True, True
    
                End If
            End If
        Next proj
    
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,473 questions
{count} votes