Bring your tasks in a row

How to import Microsoft Project files into Microsoft Excel

mpp_to_xls Have you ever managed a larger project with several subprojects, hundreds of tasks and milestones, dozens of members in the project team and even more other staff contributing to the project, spread all over almost every department of the company? If so, you might have used Microsoft Project to plan and monitor the project.

Since there were so many different people contributing, you may have encountered the following challenge: You had to distribute the actual project plan to all team members at least once a week, but not everyone had Microsoft Project installed on his computer. So you couldn’t simply send the Microsoft Project file.

Sounds familiar? What do you usually do?

You copy the project plan as a picture and paste it into a PowerPoint file? I don’t think so. If it is a really big project, I bet you tried this only once.

You create a PDF? Well, this looks better, but still needs some PDF-creating software installed on your computer. Even if you have a PDF-creator, PDFs are quite inflexible.

This is still a workaround, but wouldn’t it be better to provide a copy of the project plan in Microsoft Excel? Usually everyone has Excel installed on his computer. And the team members would be able to copy and paste tasks and other data, to do their own side calculations, to filter the project plan, to define the print area and so forth.

We need a little tool for importing Microsoft Project Files into Excel with ease.

Of course Microsoft Project provides a built-in function to export data from a MPP-file to Microsoft Excel by clicking “Save As” and selecting “Microsoft Excel Workbook”.

The result usually looks like this:

Project Standard Export - click to enlarge

Compelling? Not really. A starting point, but it would still be a long tramp to transfer this into something useful like this one:

Project Plan xls - click to enlarge

Project plan example taken from Microsoft’s Office Online Website (project management plan)

Looks better, doesn’t it? And yes, this is Excel.

What if you could produce this with only a couple of clicks?

Well, here is a way to do this:

Download Import MPP into XLS (Excel 97 – 2003, 152.5K)

The used Excel functions and features:

  • A few named ranges
  • Conditional formatting to highlight the first three PSP-levels in different shades of grey
  • MIN function to calculated the project start date
  • ROUNDDOWN function to round start and end dates to full days
    (used in the hidden columns L and M)
  • Conditional formatting to create the pseudo Gantt chart
    (black fill color for tasks, orange fill color for milestones)

Advanced Excel features, but no rocket science.

Additionally there is – of course – some VBA code managing the automatic import from Microsoft Project. But even this is only 90 lines of code, including a nice progress indicator I “borrowed” from John Walkenbach's brilliant website. Thanks John!

The VBA code (started when clicking on the worksheet button) is not too complicated. Here is what it does:

  • Let the user select the project file to import (in a standard open-file-dialog)
  • Delete all exiting data in the Excel file
  • Open the Microsoft Project application (if installed)
  • Loop through all the tasks of the Project file and write the defined information to the Excel worksheet
  • Close the Microsoft Project application

For anyone who is interested in the code in detail: the workbook provided for download is without password protection. If you want to, go and figure it out.

A short summary

The advantages

  • Import Microsoft Project files into Excel with a couple of mouse clicks
  • Display your complete project plan in a professional Excel template without any further effort on formatting, etc.
  • Provide all your project team members with the actual project plan in Excel and enable them to do more than just print

The shortfalls

  • The tool uses a hardcoded structure of imported project columns (WBS, task name, duration, start, end, predecessor, successor, resource initials). If you want to change this, you will have to change the VBA code and – in case you need additional columns – also the structure of the workbook
  • It is a one-way street: if anyone changes the project plan in Excel, you would have to manually update the Microsoft Project file
  • The file for download is restricted to 150 tasks and 200 days. You can easily change that by inserting the number of required rows and columns somewhere in the middle of the existing table and copying down and right the formulas and formats from above and left

The tool for free download:

Download Import MPP into XLS (Excel 97 – 2003, 152.5K)

The tool has been tested with Excel 2003/2007 and Microsoft Project 2003. You need to have Microsoft Project installed to run the macro.

Comments

113 responses to “Bring your tasks in a row”

  1. Gypsy1962 Avatar

    Interesting article! I tried to import a sample mpp that I have and discovered that the VBA stops within the debugger complaining about an undefined reference to the “Format” function on line 63:
    Me.fmeProgress.Caption = Format(varRowCount / varProj.Tasks.Count, “0%”)
    Am I missing a component I should have installed?
    Thanks…

  2. Robert Avatar

    Gypsy1962,
    first of all thanks for kicking off comments on the project management posts!
    I tested the code with a couple of different mpp files and it always worked fine. You don’t need to have anything else installed than Excel and Project.
    It seems as if varProj.Tasks.Count (total number of tasks) is 0 and the division by 0 stops the VBA. This should only be the case if the project plan file is empty, i.e. has no tasks or milestones.
    But I can’t tell you any details without seeing the file. If you want to send me the mpp and which versions of Excel and Project you are using, I will have a look at it as soon as possible and give you feedback. You will find the email-link at the left column of the blog.

  3. Gypsy1962 Avatar

    Thanks for the quick reply! I could/should have provided these additional details originally.
    1 – I only push the button to initiate the mpp file load to recieve the error described. This is using the spreadsheet in an ‘as downloaded’ condition. The error results almost immediately prior to an mpp file load. My mpp file never actually loads since the error occurs prior to that happening.
    2 – I have commented that line out of the VBA, and the import works as described in the article although the progress bar looks a bit squirrely. My mpp imports fine.
    3 – I’m using XL 2007 & MS Project Standard 2007.
    Also, do you know if the Format function is intrinic to Excel? I want to say yes, but yet I can find no function help for “Format” within excel. I did take a peek at the referenced Walkenbach article, and the Format function is used there which leaves me a bit baffled? Maybe one of the arguements in the code is “bothering” the function?
    Thanks again!

  4. Robert Avatar

    Gypsy1962,
    I double checked this with the file posted for download and two different mpp files. On my machine, using Excel 2007 and Project 2003 it works like a charm. I do not have Project 2007 available, so I guess the problem might be a Project version issue.
    It is weird though. If I understood your comment correctly, the error occurs even before you see the open file dialog. Did I get this right? If so, I can’t explain why. The routine starts with calling Application.GetOpenFileName and if you do not select an mpp file, there is an Exit Sub statement in the IF-clause. If you don’t see the open file dialog, the code should never reach line 63 with the format-function.
    The only idea I have: Did you check the references of the VBA-project? Which version of the Microsoft Office Project Library is selected?
    Finally: Format is a standard VBA Function:
    http://msdn.microsoft.com/en-us/library/59bz1f0h.aspx
    I think it should be in the VBA help as well.

  5. Gypsy1962 Avatar

    I’ve done some additional checking as well. As long as the line containing the format statement is commented out, the import spreadsheet works fine. I’ve imported multiple project files as well with no problems. Therefore I don’t don’t believe there’s any flaw in the spreadheet vba. The problem I’m having is clearly related to the format function (or absence thereof). I’m not sure why it’s a problem though in my installation. I wonder what office product (or VBA installation) is responsible for including the format function? I have vba included in all of my office applications. Addionally, I have many spreadheets that make extension use of VBA. I’ll continue to investigate and let you know what I discover.
    Thanks for all of the help!!
    P.S. Is there a convenient way to determine the version of the Office Project Libray?

  6. Robert Avatar

    Gypsy1962,
    to check the references of a VBA project go to the VBE and select Tools|References. The references dialog box opens and you will see the libraries selected on top of the list. In my case (Project 2003) it is – among others – Microsoft Project 11.0 Object Library. What do you have? Version 11.0 or 12.0?
    The easiest way out would probably be simply removing the progress indicator. It is a nifty little feature, especially for larger project files on slow machines, but it is not really necessary…

  7. Gypsy1962 Avatar

    Checked; I have version 12.0 of the Object Library and it’s enabled.
    Disabling the progress bar is my work-around for the moment.
    Bugs me though because Walkenbach’s Progress Indicator from his website (progind.xls) works exactly as advertised AND it uses the Format function!
    I don’t think I posted this previously. Here’s a snapshot of the error dialog. Cursor left at line 63 with the “Format” function name highlighted.
    Again, commenting that single line out eliminates the compile error.
    Grrrr….

  8. Robert Avatar

    Gypsy1962,
    I have to admit I am at my wits’ end regarding your problem.
    These are the library references that need to be enabled for running the VBA:
    – Visual Basic for Applications
    – Microsoft Excel 12.0 Object Library
    – Microsoft Project 11.0 Object Library (12.0 for Project 2007)
    – Microsoft Forms 2.0 Object Library
    If you have all of them enabled, the VBA should work.
    Last idea: Change the priority of the Project Library and the Forms Library using the up and down arrows of the reference dialog. It is worth a try but I guess there is not a snowball’s hope in hell that this will resolve the issue…
    I am sorry that I can’t help you with this.
    P.S. You can’t insert a screenshot into a comment, but you can upload the image to e.g. box.net and provide the link in your comment.

  9. JD Avatar
    JD

    I had the same problem too. It was caused by the reference to the Microsoft Office Project Calendar Control. It was set as 11.0 but as I have Project 2007 I nejust removed the that refernece and added in the 12.0 refernce and all is good.
    Jason

  10. Robert Avatar

    Jason,
    Thank you very much for your comment.
    So the Project Calendar Control reference was acting up when using Project 2007. Actually this reference is not even necessary for the VBA.
    My bad. I didn’t clean up the references before posting. Sorry.
    I updated the file now (with only the required references enabled) and I hope this one works with Project 2007 as well. I can’t test it because I have no Project 2007 installation available.
    Many thanks again for your input.

  11. Julie Avatar

    Hi Robert
    Can’t believe it – this is exactly what I’m looking for – am working with Project 2007 (we’re not for profit) – but partners in Excel and mostly Excel 03 – your fantastic add in is working for me but I guess am doing something stupid as I cannot see how to change date range to show full project. It’s only showing to end of 2009. Can you please advise.

  12. Robert Avatar

    Julie,
    many thanks for your comment.
    If I understood your question correctly, your problem is the limitation of the pseudo gantt chart to 200 columns in the version posted for download. You might expand this by simply copying column HF to the right. Unfortunately Excel 2003 and earlier is limited to 256 columns, leaving only 242 columns for the pseudo gantt in the workbook posted for download (i.e. less than a year on a daily basis).
    You may change the time axis in the workbook to a weekly basis by
    1. changing the formula in cell P6 from =O6+1 to = O6+7 and copying the formula to the right and
    2. changing the formulas in the hidden columns L and M to calculate the date of the previous Monday, e.g. in column L:
    =ROUNDDOWN(IF(WEEKDAY($F8)=1,$F8-6,$F8-WEEKDAY($F8)+2),0)
    If I didn’t understand your question correctly, do not hesitate to come back.

  13. Julie Avatar

    Hi Robert
    Thank you very much for coming back so quickly – and yes, what you advised above works. this is such a help. Am astonished (or maybe not!) that this facility is not included in Project.
    Thank you again
    Julie

  14. mohan Avatar
    mohan

    This is an excellent tool, I am unable to edit the code to add new columns, please let me know how i can see the source code behind. Guess this is password protected now

  15. Robert Avatar

    Mohan,
    many thanks for your comment and question. The VBA code is not password protected.
    Go to the VBA Editor (ALT F11), click on Forms, right click on the UserForm “frmProgress” and select “view code”.
    I hope this will be helpful.

  16. Mohan Avatar
    Mohan

    I am still having trouble to understand/access the code to change the milestone graphics (currently shown in red color)
    All my tasks/milestones are having RED/AMBER/GREEN/BLUE. Based on this status i would like to mark the milesonte colour accordingly
    Currently i am unable to understand the code how you are shown the red background color at each milestone Thanks for your help mate

  17. Robert Avatar

    Mohan,
    the coloring of the “pseudo Gantt chart” in Microsoft Excel is not done by VBA, but by conditional formatting based on the formulas in the hidden columns L and M. Unhide the columns L and M, click on any given cell in the “Gantt chart” and select Format|Conditional Formatting to see how the formulas for the conditional formatting are working.
    With Excel 2003 and earlier, however, you are limited to 3 conditions. In the example of the post, 2 conditions are already in use (black for the tasks, orange for the milestones). Hence, if you are using Excel 2003 or earlier, you will need additional VBA code to set the fill color of the “Gantt chart” cells according to the status of your tasks and milestones.
    The post There is more than one way to heat a map should get you going.

  18. Chelsa Avatar

    Absolutely loved this. It’s been ridiculously helpful for me, so just wanted to stop by and say THANKS!

  19. vineet Avatar
    vineet

    hey..hi…incredible tool.
    but I am using Project 2010 & excel 2007. Can you plz suggest sth similar for me?

  20. Robert Avatar

    Vineet,
    thanks.
    The tool works well with Excel 2010 and Project 2003. Thus, it should work with your Excel 2007 installation, too. Unfortunately I do not have Project 2010 available. What kind of problems do you have with Project 2010?

  21. Suzy Avatar
    Suzy

    It works great with Excel 2007 and Project 2010! Thank you so much for this!

  22. Tom Avatar
    Tom

    Hi
    Thanks so much for this, it’s excellent.
    I am trying to add an additional column to my import, to display the ‘Work’ column as shown in my Project Plan.
    I have tried updating the code but it doesn’t seem to work. Are you able to help?
    Many thanks

  23. Robert Avatar

    Tom,
    sure, no sweat.
    1. Insert an extra column on the Excel worksheet, right to the existing column J (Res. Initials)
    2. Expand the name “myProjectInfoRange” to cover the columns from B to K (i.e. make sure the additional column is part of the named range)
    3. Go to the VBE, right click on the form frmProgress and select View Code.
    Search for this line of code (line 60):
    varTaskInformations.Offset(varRowCount, 7) = varTask.ResourceInitials
    Insert the following additional line of code right after this line:
    varTaskInformations.Offset(varRowCount, 8) = varTask.Work
    4. Close the VBE, save your workbook and run the import.
    That’s it. I hope this will be helpful.

  24. Tom Avatar
    Tom

    Worked a treat!
    I may be back with more questions.
    Many thanks, this is excellent.

  25. Tom Avatar
    Tom

    Hi,
    I have the same question but for the “% Complete” column. I have tried adding the line
    varTaskInformations.Offset(varRowCount, 9) = varTask.Percent_Complete
    …and extended the named range. However it doesn’t seem to work.
    I think it must be a problem with the “Percent_Complete” part of the code…
    Any help you can provide would be much appreciated.
    Thanks

  26. Robert Avatar

    Tom,
    the name of the task property is PercentComplete (i.e. without the underscore you have in your comment).

  27. Sitanshu Chohan Avatar

    Hi robert,
    I stumbled across your blog while googling today and I think it’s a great read.
    My project file has over 2000 lines and I use Project 2010 and Excel 2010.
    Whiel trying out the import, i noticed that it only managed to import/format 150 lines. The other task items were just listed. Any simple way to fix this?
    All help appreciated. 🙂

  28. Robert Avatar

    Sitanshu,
    thanks for your comment.
    Yes, there is an easy way to fix this:
    Simply insert as many rows as you need somewhere above the last used row of the worksheet (row 157) and copy down the entire row above the inserted rows down (in order to have the correct formulas, formatting and conditional formatting in the new rows).
    That’s it. Let me know if you have any problems or further questions.

  29. Estevao L Rodrigues Avatar
    Estevao L Rodrigues

    Hello,
    I’m trying to make a project very simillar to what you show here (great work!) and I wanted to take a look on the codes, but it is password protected.
    Is there any way I can get the codes? Thank you very much.

  30. Robert Avatar

    Estevao,
    many thanks for your comment.
    There is no password protection. The main part of the code is in the form frmProgress. Go to the VBE, click on Forms, right click on frmProgress and select View Code. You should then be able to see the main part of the code.
    Let me know if you have any issues with that.

  31. Estevao Avatar
    Estevao

    Now I got it! Thank you very much!

  32. Estevao Avatar
    Estevao

    Robert,
    your project works as I expected, thank you very much!
    I wanted to use it in the following way: I have a list of mpp files and I want to bring them to the same sheet on excel. Do you think it is possible to do that using your project?
    thank you very much.

  33. Robert Avatar

    Estevao,
    I have never done this, but I do not see why this shouldn’t be possible. If it works for one project, it should work for more than one, too. You need to adjust the code, though.
    Without having a closer look, I suspect there are more or less only 2 things you have to change:
    1. Let the user select more than one project file in the file open dialog or let him select a folder and import all mpp files in this folder.
    2. Add another loop around the existing one (looping through the tasks) which loops through all selected project files.
    Maybe there will be some more details to take care of, but in general this should do the trick.

  34. Trevor Avatar
    Trevor

    Robert,
    This is awsome. I would like to modify teh VB code to pull resource name as opposed to initial. I have gone to varTaskInformations.Offset(varRowCount, 7) = varTask.ResourceInitials
    and changed it to varTask.ResourceName, but nothing. Do you know what the actual resource name field is called in MSP? I am using version 2007.
    Thanks!

  35. Trevor Avatar
    Trevor

    Hi Robert,
    Never mind….trail and error prevailed.
    Should be varTask.ResourceNames plural.
    Thanks for the awesome tool though…will save me much time.

  36. Robert Avatar

    Trevor,
    thanks for your comment.
    The name of the property you are looking for is ResourceNames (don’t forget the “s”…)
    Just replace .ResourceInitials by .ResourceNames and it should work.

  37. Jon Avatar
    Jon

    I’m guessing I already know the answer to this, but can I open a 2007 version through excel if I only have Project 2002?

  38. Robert Avatar

    Jon,
    I never tried, but since the VBA in Excel is opening the Project File, I think you need to download the Microsoft Project converter to make the import procedure work.
    As I said, I never tried, so this is just an educated guess.

  39. Jon Avatar
    Jon

    Ha! I’m the new guy at the office here and my boss just handed me Project 2002 Standard last week and said “See if you can install this on your machine, it won’t work on mine.”
    I had to tweak a couple registry permissions, but it installed fine after that. I didn’t check to see that I already had Project 2010 Pro installed on this computer.
    When I run your file, it uses Project Standard 2002 instead of 2010. I’m not finding where in the code it opens Project 2002 instead of 2010. If I just uninstalled MSP 2002 would that fix my problem?
    Thanks,
    You’ve created a wonderful tool here!

  40. Robert Avatar

    Jon,
    thanks for your comment and your kind words.
    I am not sure why you bother that Project 2002 opens instead of 2010, because the tool simply imports the data from there and closes Project afterwards. So, for the purpose of the tool it shouldn’t matter which project version it is using.
    Anyway, try the following: open the Excel file, go to the VBE, go to tools and references, uncheck Microsoft Project 11.0 Object Library and check Microsoft Project 14.0 Object Library instead.
    If this does not solve your issue, please do not hesitate to come back.

  41. Jon Avatar
    Jon

    Yup, that worked! It seems that Project 2002 overrode the associations somehow and now that it’s gone, Project 2010 has taken over!
    Magnificent tool!
    Thanks again!
    Jon

  42. Jon Avatar
    Jon

    Robert,
    Thanks for the help. Project 2002 cannot open Project 2010 files. There is no conversion available period!
    Project 2010 could save files back down to the 2002/2003 version, but I believe I was the only one working with 2002, so it’s now a moot point.
    Thanks again for your help with a 3.5 year old file!

  43. Robert Avatar

    Jon,
    you are very welcome. I am happy to hear that it is working for you now.
    Agreed, three and a half years old, but obviously still useful, isn’t it?
    Let me know if you need anything else.

  44. Mark Avatar
    Mark

    Is there a method of copying an extract of the imported project plan to paste into a subsequent spreadsheet (e.g. if I wanted to copy rows 19 – 54 and 149 – 175) or does plan need manipulating in MS project first?

  45. Robert Avatar

    Mark,
    the easiest way of doing this is probably to make a copy of the entire worksheet in Excel (right click on the tab and select “move or copy” and check “create a copy”) and to delete all rows you do not need in the copied worksheet. Everything will be ok except for the first column (the index) which will show #REF errors, but this is easily fixed by copying down the formula (e.g. in cell B9: =B8+1).
    That’s it.

  46. Shannon Avatar
    Shannon

    Hello, I’m using Excel 2010 and Project 2010, I have both your file and my project file open and when I click “Import Microsoft Project File” I get a visual basic error “Compile Error Can’t Find Project or Library”.

  47. Robert Avatar

    Shannon,
    I suspect this is a problem with the reference to the correct Project Library. Go to the VBE (ALT F11), click on Tools and References and see which Microsoft Project Object Library is checked. If there is no reference called Microsoft Project 14.0 Object Library, scroll through the list of available references and click the Microsoft Project 14.0 Object Library checkbox.

  48. Manish Avatar
    Manish

    This code is very useful. I have played with the code and added a few columns, and also made it look different. Really liked it and it’s a powerful medium to share the project plan while maintaining the integrity of the master. Thanks again!

  49. AS Avatar
    AS

    Hi,
    I would like to directly hardcode the location of the project file in the code rather than searching and selecting the file every time I open excel. Can you please tell me if there is a way to do this? I am new to VBA.
    I really appreciate your help.
    Thanks

  50. Robert Avatar

    AS,
    no sweat:
    Step 1: Open the workbook and go to the VBE (ALT-F11)
    Step 2: In the Project Explorer window click on Forms, right click on frmProgress and select View Code
    Step 3: In the code replace the line
    varFileName = Application.GetOpenFilename(“Microsoft Project Files (*.mpp), *.mpp”)
    by e.g.
    varFileName = “C:\project management plan.mpp”
    Let me know if you have any questions.

  51. AS Avatar
    AS

    It works :). Thanks a lot. Was great help.

  52. angela@blurevolution.com.au Avatar
    angela@blurevolution.com.au

    Thankyou very much for this and the export to Powerpoint. A huge help for some of my project team.

  53. Gordon Avatar
    Gordon

    This is a really useful tool!
    I’ve changed the sheet to show weeks per column instead of days due to the length of the project.
    This works except for one small issue; any milestone dates which do not equal the column header dates do not activate the conditional formatting.
    Any suggestions on how to fix this would be greatly appreciated!

  54. Robert Avatar

    Gordon,
    you have to adjust the formulas in the hidden helper columns L and M to make this work for weeks. Have a look at my reply to Julie’s comment on September 16, 2009 at 06:20 PM (see above). I am describing there what you have to change to get to a weekly timeline.

  55. Gordon Avatar
    Gordon

    Robert,
    That didn’t work for me as the header rows were using the earliest date in the project and this was not a Monday (I think!).
    I’ve got it working by adding an if statement to columns L and M,
    Cell L8
    =IF($F8=””,””,ROUNDDOWN(IF(WEEKDAY($F8)=1,$F8-6,$F8-WEEKDAY($F8)+2),0))
    Cell M8
    =IF($G8=””,””,ROUNDDOWN(IF(WEEKDAY($G8)=1,$G8-6,$G8-WEEKDAY($G8)+2),0))
    Then changing the formula in O6 to reference column L
    =ROUNDDOWN(MIN($L$8:$L$526),0)
    Working exactly as I need it now.
    Thanks again!

  56. muralee Avatar
    muralee

    Dear sir,
    I am using 2010 excel and 2003 Msproject.
    The code breaks.Please help.
    references i have selected is below:
    Microsoft excel 14.0 obj library
    microsoft project 11.0 obj lib
    microsoft forms 2.0 obj lib
    Code getting struck in last line shown below,
    Private Sub UserForm_Activate()
    Dim varFileName As Variant
    Dim varProjApp As MSProject.Application
    Dim varProj As MSProject.Project
    Dim varTask As MSProject.Task
    Dim varTaskInformations As Range
    Dim varRowCount As Integer
    varFileName = “C:\Users\jagadm\Desktop\Project Name.mpp”
    ‘Application.GetOpenFilename (“Microsoft Project Files (*.mpp), *.mpp”)
    If varFileName = False Then
    Unload Me
    Exit Sub
    End If
    Worksheets(“Project Plan”).Range(“myProjectFileName”) = varFileName
    On Error Resume Next
    Range(“myProjectInfoRange”).ClearContents
    Set varProjApp = GetObject(, “MSProject.Application”)
    If varProjApp Is Nothing Then
    Set varProjApp = New MSProject.Application
    If varProjApp Is Nothing Then…………code breaks in this line sir 🙂 please help,this utility is really wonderful and will be very helpful

  57. Robert Avatar

    Muralee,
    I double checked on my machine and the code is still working like a charm for me.
    3 questions:
    1. When you are saying the code breaks, do you mean the code really breaks and goes into debug mode or does a message box appear saying “Connection to Microsoft Project not possible”?
    2. If the code really breaks, are you sure it stops at the line with the “IF varProjApp Is Nothing Then” statement or is it stopping one line above?
    3. Which error message do you get? I assume the “New MSProject.Application” statement isn’t working on your machine and I was wondering why.
    Sorry, but it is difficult to provide a solution when I can’t reproduce the error.

  58. muralee Avatar
    muralee

    Thanks Robert for your time first,
    1.yes the code breaks and goes into debug mode and there is no msg box notification at all.
    2.I’m sure that the code is exactly stops at the line “IF varProjApp Is Nothing Then” (highlighted line in yellow i mean)
    3.I do not get any error message.
    I understand that your scenario is difficult,in the case not being ale to reproduce the error,thanks anyways Rob 🙂

  59. Robert Avatar

    Muralee,
    Ok, two more questions:
    1. When the code stops and you see the yellow highlighted line in the Visual Basic Editor, hover with the mouse over the variable varProjApp. A toolbox should appear. What does it say?
    2. Right beneath the IF clause where the code stops, there is the following statement: varProjApp.Visible = False. Copy this line of code, insert it above the IF clause where the code stops and change False to True. Run the code again. When the code stops at the IF clause, is Microsoft Project open?

  60. Beno Avatar
    Beno

    Robert
    You sound like the man
    Is it a similar process to do the reverse, i.e. export dates (as cell values) from Excel to Project to create a gantt?
    Using a macro clickbutton arrangement rather than the import wizard as I need to do it multiple times to compare results.
    Thanks mate
    Ben

  61. Robert Avatar

    Beno,
    sure this is possible. I never tried, but I found this solution on VBA Express:
    VBA Express – Export from Excel to MS Project

  62. ericw Avatar

    Thank you for creating this. I am not well versed with VBA but was able to make a few tweaks here and there.
    Has been working great up until I upgraded to Excel 2013. Now when I attempt an import it hangs and I have to force quite Excel.
    Any thoughts?

  63. Robert Avatar

    Eric,
    I double checked and the original version I posted for download above is still working like charm, also with Excel 2013 and Project 2013.
    If your version acts up, I would assume it has to do with the changes you made. I can’’t say what the problem is without seeing your version of the code. If you want to, you can send me your workbook by email and I will have a look.

  64. ericw Avatar

    Never mind. I turns out there was an issue with the install of Excel 2013 and the scripts do in fact work once the Excel 2013 issue was resolved.
    Again, great tool!

  65. Fiosco Avatar
    Fiosco

    Dear Robert
    I tried using your macro, I get no errors but at the end the excel page stay blank. Any suggestion? I have Excel 2010 and projec 2007 installed.
    amazing work!

  66. Robert Avatar

    Fiosco,
    go to the VBE, select the form frmProgress, right click, select view code and in the code comment out or delete the line “On Error Resume Next”. Run the macro again. If the code stops and you get an error message, click on Debug to get to the VBA and check at which line the code stopped (yellow background). Post another comment here or send me an email and describe what happened without the On Error statement.

  67. Tim Avatar
    Tim

    This is great – Thank you

  68. Gerry Avatar
    Gerry

    I like it lots!!!
    Tested with Excel 2013 64 bit and MS Project Pro 2013 64 bit
    The VBA project references are a pain and I did have to add a reference to Microsoft Project 15.0 Object Library, which for me wasnt even referenced as a library and I had to manually locate it in
    C:\Program Files\Microsoft Office\Office15\MSPRJ.OLB
    (use the Browse button on the “Refereces” dialg.
    Thanks very much for your hard work!

  69. Jose Zaldivar Avatar

    I appreciate very much this code. I used MS Project and often need to report on tasks, costs, etc. By using this tool, I can get these details and others. Then I apply EXCEL Pivot and Charts. Bang! I have my nice charts on my project.
    I will be great to extend this and also extract the resources in another sheet.
    Very much appreciated!

  70. Hilary Avatar
    Hilary

    This code is exactly what I am looking for! Thank you!!
    In adjusting the code, I’m getting stuck on this line:
    Worksheets(“Project Plan”).Range(“myProjectFileName”) = varFileName
    If I understand this correctly, the worksheet is the name of the tab in Excel, and the range is the name of the Project file? I’ve actually tried both Project and Excel file names and it won’t work.

  71. Robert Avatar

    Hilary,
    “Project Plan” is indeed the name of the worksheet. If the sheet with the project plan has a different name in your workbook, you have to change the name in the VBA code accordingly.
    “myProjectFileName” is the name of the cell C5 on the worksheet. The code gets the file name with a File Open Dialogue window and it stores the name of the selected project file in this cell. But this is for informational purposes only (to document which file has been imported). If you do not need this information, you can delete the entire line of code. The import will still work.

  72. Hilary Avatar
    Hilary

    Thanks for the quick reply!
    That makes perfect sense. “myProjectFileName” is actually B5, and I found “myStartProjTaskInfo” is C7. Made those changes on my spreadsheet and it works perfectly! Thanks!

  73. Robert Avatar

    Hilary,
    you are right, it is B5. Sorry for the typo. I am glad you got it working now.

  74. Manuj Avatar
    Manuj

    Hi,
    Many thanks for the tool. I found this tool to be very useful as this allows me to share the planning info with my team mates who do not have mpp installed.
    One question – currently there is no way to show a milestone (0 days) in the xls. Can you please tell me how can I achieve this in the tool

  75. Robert Avatar

    Manuj,
    the tool does import milestones, too (duration 0 days), no changes necessary from my point of view.
    However, it highlights all tasks in the Pseudo-Gantt in Excel which have the same start and end date with an orange fill color, i.e. milestones and tasks which have a duration equal or greater than 0 and less or equal one day.
    If you want to highlight only milestones, you have to change the Conditional Formatting rule of the Gantt-range. The new Conditional Formatting rule would not check if start and end date are the same, it would rather check if the duration of the task is zero.

  76. Manuj Avatar
    Manuj

    Many thanks. That helped me fix the issue. I had to keep the existing conditional formatting and had to add one more and condition to check whether duration = 0.

  77. From Iran Avatar
    From Iran

    Many thanks for the tool.You made my day.amazing work!

  78. farzaneh Avatar
    farzaneh

    Dear Sir
    I get this error on the line “Dim varProjApp As Application.MSProject”
    “compile error ,Data type mismatch”
    I am using Office 2013.(Microsoft Project 15.0 Object Library checked)
    But when i wanted to check the errorand typed exactly the same line above ,noticed the part “MSProject” is not in the dropdown list.
    Your Prompt reply would be highly appreciated .

  79. farzaneh Avatar
    farzaneh

    I made a mistake and found it.Thank you very much for your excellent work.

  80. Amish Avatar
    Amish

    Hi
    Your code work smooth. This is Gem!! Thank you for this.
    I have one question. I want to Import Status Column. When I am doing this
    varTaskInformations.Offset(varRowCount, 1) = varTask.Status
    The value in Status column is not coming as Late, On schedule or Future Task, instead some Numbers are getting populated. Can you please help.

  81. Robert Avatar

    Amish,
    Project stores the current status of a task as a number, not as the text that is displayed in Project: On Schedule is 1, Late is 2, Future Task is 3, etc.
    Have a look here:

    PjStatusType Enumeration

    The VBA code imports what is stored in Project and writes it to the sheet, i.e. the numbers, not the text. You either have to change the code to transfer the number to the according text or you create an extra column on the worksheet with a formula assigning the correct text to the number.

  82. Amish Avatar
    Amish

    Thanks Robert for the update. I figured that while I was posting but still wanted to confirm.
    I have another question in general for MS project. I didn’t find answer to that anywhere. Thinking to ask you.
    I am using Status column’s values like Late, On Schedule, future Task etc in a Filter. What I am noticing is, it is not updated correctly by MS project. Example: My Project status date is 2/24/2017. Tasks which are not marked 100% and have Finish date as 2/23/2017, are marked as On Schedule instead of Late. On 2/25/2017, this task will be marked as Late. That means Project is marking a task “Late”, two days after instead of next immediate date. Are you aware of this and is there any workaround for that?

  83. Robert Avatar

    Amish,
    I can’t reproduce your issue. If I have a task with a Finish Date 2/23/2017 and a % Complete of less than 100%, the task is marked as Late (as it should) if today is 2/24/2017 or later.
    If the task starts on Thu, 2/23/2017 and has a duration of 3 days, i.e. a Finish Date of Mo, 2/27/2017, today (Sa, 2/25/2017), the Status will depend on the % Complete: if the task has a % Complete of less than 67%, the task is Late, if the % Complete equals or is higher than 67%, the task is On Schedule, because there is still one day of three days left to complete it and only one third or less of the work has to be done.
    This works like it should from my point of view.
    What is not updated by Project is indeed the filter you may have applied. Let’s say you filtered all tasks with the Status Late and then change the % Complete of one task in a way which changes its Status from Late to let’s say Complete, this task will still be visible, i.e. the filter will not be updated automatically. You have to reapply the filter to get to the list of all late tasks.

  84. Amish Avatar
    Amish

    Thanks for the note. I understand you can’t reproduce the error. Appreciate your note on other details.

  85. Paul Avatar
    Paul

    Would be good if it could also show a week view rather than day view.

  86. Robert Avatar

    Paul,
    please refer to my reply to Julie’s comment on September 16, 2009 at 6:20 PM.

  87. Anwer Shahabuddin Avatar
    Anwer Shahabuddin

    Cannot look at the code (i need to modify it to accept large projects and possibly show a smaller time scale). A dialog appears asking for the password.
    thanks & regards
    Anwer – Anwer@Shahabuddin.com
    Also, I initially started with writing a small segment of code to copy tasks from mpp to excel (nothing elegant like this one!). Got to the point where the mpp file successfully opens. However, the code to fetch each tasks fails on the first line.
    Here is the code:
    Private Sub CommandButton1_Click()
    Dim appProj As MSProject.Application
    Dim t As Task
    Dim myProject As MSProject.Project
    Dim tCol, sCol As Integer ‘******** Source Path Start Column ********
    Dim Qual_File_Name As Variant
    sCol = 12
    ‘AppActivate “Microsoft Excel”
    With Worksheets(“Sheet1”)
    ‘——— Construct the Fully Qualified Source FIle Name in Var Qual_
    Qual_File_Name = _
    .Cells(2, sCol) & “\” & _
    .Cells(3, sCol) & “\” & _
    .Cells(4, sCol) & “\” & _
    .Cells(5, sCol) & “\” & _
    .Cells(6, sCol) & “\” & _
    .Cells(7, sCol)
    End With
    ‘Qual_File_Name = Qual_File_Name
    ‘MsgBox Qual_File_Name
    ‘========= Create Object ==========
    Set appProj = CreateObject(“Msproject.Application”)
    ‘========= Open MSP File ==========
    ‘appProj.FileOpen “C:\@Z686669\01 – Projects\02 – DRM\04 – Project Plans\Wireless DRM Transition – FRPA – 12112017 V1T.mpp”
    appProj.FileOpen Qual_File_Name
    ‘========= Set Active Project =========
    Set myProject = appProj.ActiveProject
    With Worksheets(“Sheet2”)
    For Each t In myProject.Tasks
    ‘ ******* For Each t In ActiveProject.Tasks
    MsgBox t.ID ‘ ****** this where the code FAILS ******
    .Cells(1, 1).Value = t.ID
    .Cells(2, 2).Value = t.Name
    .Cells(3, 3).Value = t.Start
    .Cells(4, 4).Value = t.Finish
    Next t
    End With

  88. Robert Avatar

    Anwer,
    the VBA code is not password protected. I assume you clicked on the wrong VBA project in the VBE (maybe on an add-in you are running?). The VBA project in the workbook I posted for download is not password protected. All you have to know is that the main code is in the form frmProgress (right click on frmProgress and select View Code).

  89. Anwer Shahabuddin Avatar
    Anwer Shahabuddin

    Thank you. I can see the code contained in the form and will work to modify it for my needs.
    The utility that you have developed is excellent!
    Your insight into Why does my code above, fail to fetch the tasks, will be much appreciated. It abends on with run time error 91 stating Object var or With block var not set.
    Regards,
    anwer

  90. Robert Avatar

    Anwer,
    except for the missing End Sub in your snippet, the code works for me. It writes the task information always to the same cells on the sheet, so you would have to increase the row counter in the For Each t statement, but other than that, the code works.

  91. Anwer Shahabuddin Avatar
    Anwer Shahabuddin

    Aamazing! I cant get past it? It must be something environment related, for as you said the code worked in yours. I am not sure what/where to look-but I will try.
    Yes, the rest of the code and row increment I have not put in yet.
    thanks,
    anwer

  92. Anwer Shahabuddin Avatar
    Anwer Shahabuddin

    Hi,
    How do I get rid of CPMDrill.XLA an HstBar.XLA? I ran your macro a couple of times but now whatever I create seems to have these VBA projects and I am yet to find a means to remove delete them from the workbook. Your help will be appreciated.
    Working on expanding your macro to access at least 3k tasks and a weekly or monthly timescale.
    regards,
    anwer

  93. Anwer Shahabuddin Avatar
    Anwer Shahabuddin

    Strangely enough your code plugged into my excel, yields the same error i.e 91, on the following line:
    For Each varTask In varProj.Tasks
    MsgBox varTask.OutlineNumber
    I am curious, and if you permit, I like to send you the two excel documents for a quick review. Please advise how addressing my email address below.
    thanks & regards,
    anwer

  94. Robert Avatar

    Anwer,
    XLA files are Excel Add-Ins and have nothing to do with my code. You or your system administrator defined in Excel’s Add-In options to start these Add-Ins when Excel is opened. My code does not start or require any Add-Ins.
    Having said that, I doubt that your problems arise from those Add-Ins, but since I do not know these Add-Ins, I can’t give any guarantees.

  95. Robert Avatar

    Anwer,
    make sure you have set the reference to the Microsoft Office Project Library in the Visual Basic Editor (Tools|References).

  96. Anwer Shahabuddin Avatar
    Anwer Shahabuddin

    Understood, thanks.
    How could I send you my workbook? I created two versions, one with my code segment and one with yours. Both are giving me runt time errors.
    Regards,
    anwer

  97. Anwer Shahabuddin Avatar
    Anwer Shahabuddin

    Yes, I have multiple library versions checked. Prior to that, I was getting errors in type declarations.
    thanks,

  98. Robert Avatar

    Anwer,
    there is an E-Mail-link at the top of the blog.

  99. Anwer Shahabuddin Avatar
    Anwer Shahabuddin

    May be I am behind a firewall or something. Depressing your link does not open a dialogue. Hovering over the link displays “send email to”clearlyandsimply….”
    regards,

  100. Robert Avatar

    Anwer,
    I just double-checked and the link is still working for me. I guess this may indeed be an issue with the security or firewall settings in your environment.

  101. Savy Avatar
    Savy

    Hi Robert,
    Thank You for this amazing code, works like a charm. One question though, I am not sure how to expand the range. The code fetches the data for the new columns that I have added but it does not clear the contents the next time around like it does for columns 1 through 7.
    Appreciate your help.
    Thanks,
    Savy

  102. Robert Avatar

    Savy,
    you have to adjust the range of the name [myProjectInfoRange] in the Name Manager.

  103. Savy Avatar
    Savy

    Hi Robert,
    Thank You, so much.
    -Savy

  104. Savy Avatar
    Savy

    Hi Robert,
    I am looking for a way to import my project plan in excel which has colored cells to indicate the start and finish dates for each task and I am unable to get this information into MS project.
    Any help will be truly appreciated.
    Thanks,
    Savy

  105. Robert Avatar

    Savy,
    I am sorry, but I do not understand your question. The Excel tool posted above for download imports all tasks from a MS Project file into an Excel sheet and the cells right to the cells with the task information uses conditional formatting to visualize the tasks (start to finish date) in a pseudo Gantt “chart”.
    I do not understand what you mean by “…indicate the start and finish dates for each task…”. Isn’t this already done in the tool above?

  106. Savy Avatar
    Savy

    Apologize for my late reply but I am looking to import an excel project plan into MS project. So in excel, is a task spans through two weeks then two cells for those two weeks is highlighted manually in a specific color. Same for all tasks, so it is difficult for me to automatically upload this to MS Project

  107. Robert Avatar

    Savy,
    I do not have a solution to post for download, but here is one possible way how you could approach this challenge:
    First you need to get to a table in Excel including at least the name, the start date and the end date for all tasks. I do not know how your Excel sheet looks like, but if you have only manually colored cells to indicate start and end of a task, you need to use either formulas (like GET.CELL) or a VBA user defined function to extract start and end date from the colors of the cells and the cell range containing the dates of the time range.
    After you have the table with task name, start and end, you can either copy and paste the tasks into a Project file or use Project’s import function (New | New from Excel workbook) to get the information into a Project file.

  108. Savy Avatar
    Savy

    Thanks Robert, I was able to convert the file and import the plan into Project. Thank You very much.
    I have another question, I am using this amazing code to export project plan to excel. IT brings in all of the tasks except the Project Summary Task which is Task 0. Currently since it does not bring that task in, I am unable to see the %Complete for the overall project.
    Can you please help me.
    Thanks,
    Savy

  109. Robert Avatar

    Savy,
    the import routine loops through the tasks collection of the project and writes the defined information for each task to the worksheet in Excel.
    The Project Summary Task, however, is not part of the tasks collection and therefore it is not imported in Excel.
    To get the Project Summary Task into Excel, you must add a few statements before the For Each loop statement like this:
    […]
    varTaskInformations.Offset(1, 1) = varProj.ProjectSummaryTask.Name
    [… additional statements to get more properties of the Project Summary Task as needed…]
    varRowCount = 2
    For Each varTask In varProj.Tasks
    [… rest of the code as it is…]

  110. Savy Avatar
    Savy

    Hi Robert,
    I added the code and the properties but I am getting the run-time error 9- Subscription out of range.
    Not sure what am doing wrong, can you please help.
    Thanks,
    Savy

  111. Robert Avatar

    Savy,
    the error indicates that the code addresses an object that does not exist. Without seeing the code, I cannot tell what the specific problem is. You can send me your workbook per email (email link at the top of the blog) and I will have a look as soon as I have the chance to.

  112. Savy Avatar
    Savy

    Hi Robert,
    I was able to get around the error. But after analyzing the need to write the Project summary task to the excel file, I found that it did not serve the purpose I initially envisioned.
    Thank You for kick starting with the piece of code though.
    -Savy

  113. Heather Avatar

    This tool provides a seamless solution to import Microsoft Project files into Excel, facilitating easy sharing and collaboration within a project team. The Excel template offers a professional layout with named ranges, conditional formatting, and a pseudo Gantt chart. The VBA code efficiently manages the import process, enhancing user experience.

Leave a Reply to Trevor Cancel reply

Your email address will not be published. Required fields are marked *