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

February 4, 2013 at 4:06 pm | Posted in Add-on, Administration, Configuration, Customisation, Functionality, Reporting, VBA | 3 Comments
Tags: , , , , ,

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 using an image viewer web part – 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.

Advertisements

Create a free website or blog at WordPress.com.
Entries and comments feeds.