I have a situation where I need to have version number on each document in version controlled document library. Having version number on printed sheet would help to see the validity of document.

I did read following which helped me in setting up label for word document but I need to do same for excel spreadsheet and if possible for Visio diagram. https://stackoverflow.com/questions/508229/how-can-i-include-value-of-sharepoints-version-column-in-a-word-document/590444#590444

  • Did you try following those steps but instead of using a Word document, using an Excel file? My assumption is the process is probably 99% the same, just wondering if my assumption is wrong.
    – shufler
    Nov 29, 2011 at 22:46
  • 1
    I though same initially but With word you get button "quick parts" under insert ribbon, through which you can add document property label. where as with excel there is no button for quick parts. As you have turned on the information management polity for label you do get a label button under insert ribbon in excel but it does not work.
    – user4408
    Nov 30, 2011 at 0:27
  • The text section on the insert tab is screaming for a Quick Parts button... Too bad :(
    – shufler
    Nov 30, 2011 at 1:38

2 Answers 2


Here is the answer for Excel. A similar solution should work for Visio.

Create a new column in your library called "SPVersion". Use SharePoint Designer to create a workflow that copies the file version ("Current Item" "Version") to your SPVersion column. In Excel, add the following VBA code to the ThisWorkbook module:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
  Dim wb As Workbook
  Set wb = ThisWorkbook
  For Each prop In wb.ContentTypeProperties
    If prop.Name = "SPVersion" Then
      SPVersion = prop.Value
      Cells(1, 1).Value = SPVersion
    End If
  Next prop
End Sub

This code will run when the workbook is printed and it'll put the value from your SPVersion custom column into Cell 1:1.





It appears that Quick Parts are not available in Excel, though the rumblings on the webs suggest maybe they should be...

While not the same (but similar), you could set up the document library as suggested in the SE post, and then create a template in the document library that contains the VBA function listed on this page. I haven't tried it myself, but in theory if you use the same property you define in the library, it may work.

Edit: As per Diego Hillesheim's comment the link is broken due to a PHP error. Neither Google nor the Way Back Machine have a cached copy. I should have quoted the relevant section here. :(

  • 1
    Built-in document property does not have version as a property field to display.
    – user4408
    Nov 30, 2011 at 5:05
  • 1
    The link is broken Jun 11, 2014 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.