Open an mpp file using vba
Solved
blalaa
Posted messages
171
Status
Member
-
blalaa Posted messages 171 Status Member -
blalaa Posted messages 171 Status Member -
Hello
I would like to open a file of type "Microsoft Office Project Document (.mpp)" (from an Excel workbook) so that I can retrieve data, but I'm having trouble.
I tried using this code, but the format is not suitable.
Another question
Once I open the file, can I retrieve data like in Excel or not?
Thank you in advance for your responses.
I would like to open a file of type "Microsoft Office Project Document (.mpp)" (from an Excel workbook) so that I can retrieve data, but I'm having trouble.
I tried using this code, but the format is not suitable.
Sub ChoixFichier()
Dim Fichier As Variant
Fichier = Application.GetOpenFilename("All files (*.*),*.*")
If Fichier = False Then Exit Sub
Workbooks.Open Filename:=Fichier
End Sub
Another question
Once I open the file, can I retrieve data like in Excel or not?
Thank you in advance for your responses.
1 answer
-
Hello,
A simple internet search:'~~> Code to open MPP file in Excel Sub Sample() Dim appProj As MSProject.Application Dim aProg As MSProject.Project Dim wb As Workbook Dim ws As Worksheet Set wb = ActiveWorkbook '~~> This is the Sheet Where you want the data to be copied Set ws = wb.Sheets("Sheet1") Set appProj = CreateObject("Msproject.Application") '~~> This is a MS Project File. Change path as applicable. appProj.FileOpen "C:\MS Project.mpp" Set aProg = appProj.ActiveProject appProj.Visible = True '~~> Now you have the MPP file opened, rest of the code goes here End Sub
--
Best regards,
Jordane-
Thank you very much
I will test it
For my second question: when I open the file, can I retrieve data like Excel or not?
Thank you again- Not "like" Excel... but yes, it's possible to retrieve information...
for example, looping through the different tasks... something likeFor Each Tsk In aProg.Tasks MsgBox Tsk.Name Next
Anyway... you have to search...
The information I'm giving you... I can find it in just a few seconds on forums...
I don’t have MsProject on hand to test them.
-
-
-