Adding variables to header footer of excel?

In our excel files we have variables in specific cells, however I would like to add them to the header and the footer. So they are not in the way when we update the formats of files.

Is this possible? Do I need to use a macro, just as we do for adding the variables to a word documents' header or footer?

Thanks,

Laura

SolidworksSolidworks Pdm enterprise Pdm
Answers 4
JC
JC 2013-06-18 Best Answer

Custom VBA will be required to retrieve the properties and then write them to the header/footer. Our Excel template we have a Main sheet and then a sheet called "Data" which contains the named cells that the custom properties are linked to. Then on the main sheet where the document information resides the user simply makes the cell they to show the PDM revision letter "=Revision". And then "=Description" and "=DrawingNumber", etc. That way the user has very little to try and format.

SF
SF 2013-06-18

That is an interesting idea.  However some of our users have trouble with formulas in excel.  The custom VBA doesn't scare me too much. I might be close to figuring it out through some excel forums.

JC
JC 2013-06-18

Yeah...looks like the code for pulling from the properties and pushing to teh header/footer is fairly simple.

Here's our Excel template for reference.

SF
SF 2013-06-18

Found the VBA Code in case anyone else is wondering this i

Private Sub Workbook_BeforePrint(Cancel As Boolean)

Rev = ThisWorkbook.CustomDocumentProperties.Item("Revision")

ActiveSheet.PageSetup.LeftHeader = "Revision =" & Rev

End Sub

Now for the fun of formatting.