Home > Paul Mather, Work > Dynamic Timeline image on #ProjectServer Project Site #PS2010 #SP2010 #MSProject #VBA

Dynamic Timeline image on #ProjectServer Project Site #PS2010 #SP2010 #MSProject #VBA

Paul Mather
I am a Project Server and SharePoint consultant but my main focus currently is around Project Server.
I have been working with Project Server for nearly five years since 2007 for a Microsoft Gold Certified Partner in the UK, I have also been awared with the Microsoft Community Contributor Award 2011.
I am also a certified Prince2 Practitioner.

This article has been cross posted from pwmather.wordpress.com (original article)

One question we have from many clients is, can we have the project timeline image on the project site. The answer is yes, but this will not update automatically in Project Server 2010. On a side note, it is possible to have the timeline view in Project Server 2013 PWA!

This blog post covers a workaround to this limitation in Project Server 2010 using VBA. At this point I will state that I am no VBA expert, my VBA knowledge is very limited to say the least. This is a simple macro but I’m sure it could be improved Smile 

For this to work a custom DLL is required on the workstations as there is no option to save a clipboard image to a file in VBA (as far as I know!). The DLL can be downloaded here: http://www.vbforums.com/showthread.php?585616-clipboard-activex-for-vba-vbs-etc Use this at your own risk as I do not know the code behind this DLL!

For this example, I created a file share to store my images \\vm353\ProjectSiteTimeLineImages. All users will need read / write access to this share.

The VBA code can be seen below, add this to the Enterprise Global:

Private Sub App_ProjectBeforePublish(ByVal pj As Project, Cancel As Boolean)
Dim clip As Object
Dim proj As Project
Set proj = ActiveProject
Dim path As String
path = "\\vm353\ProjectSiteTimeLineImages\"
Dim file As String
file = ".bmp"
Dim fileName As String
fileName = path & proj & file

Application.ViewApply Name:="Timeline"
Application.TimelineExport SelectionOnly:=0, ExportWidth:=1000
Application.ViewApply Name:="Gantt Chart"
Set clip = CreateObject("clipbrd.clipboard")
SavePicture clip.GetData, fileName
Set clip = Nothing
End Sub

Before a project is published the timeline image will be saved as a file to the share. See the example / walkthrough below:

File share before publish:

image

Create a new project, save and publish:

image

File share after publish:

image

Image:

image

Now we have the timeline as an image, this needs to be added to the project site – I won’t go into the details as this is basic SharePoint end user config task. See the Project site below with the image:

image

Notice only 3 tasks are added to the timeline, lets add some additional tasks.

I have added task T5 and added this to the timeline:

image

After publishing this project, refresh the project site:

image

A nice simple solution to a dynamic timeline image on the Project Server 2010 Project Sites. After publishing more projects, more timeline images will appear in the shared folder:

image

As mentioned, the VBA could be improved with error handling etc. Use this and the custom DLL at your own risk and fully test on a test workstation and PWA instance first.

Categories: Paul Mather, Work Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment