Feb 03 2020 11:20 AM
PS: If there is another way to do this, like reference a named section somehow from within the header, that's what the ^[Doc] was meant to be. But everything online points to VBA.
I would the page header to display some values from the workbook as values in the header. I did google this and none of the results we're able to produce anything working. Not even any errors, the headers just stay blank.
So here is what I would like to be referenced:
And here is the VBA code I have been trying to make work. This is just the latest snippet I have worked with, Its been a few days of scouring the internet for something that will work. I am convinced it's my implementation that is incorrect.
Function Author()
Author = ThisWorkbook.BuiltinDocumentProperties("Author")
End Function
Function Doc()
Doc = Worksheets("WorkInstructions").Range("D2").Value = ThisWorkbook.CustomDocumentProperties.Item("Doc").Value
End Function
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim sTemp As String
With Worksheets("WorkInstructions")
sTemp = .Range("Z4").Text
PageSetup.LeftHeader = sTemp
End With
End Sub
Any input on this matter would be greatly appreciated, even if you don't think you have the answer. :)
Feb 03 2020 12:08 PM
@MrSassyBritchesPlease elaborate as to the determining factor for what data appears..?
Feb 03 2020 12:11 PM
Feb 03 2020 12:16 PM
Well the header wont be visible until printed, so when printed I guess.
Feb 03 2020 12:17 PM
Feb 03 2020 12:23 PM
How bout making a1 ( or what ever cell you choose ), =z2 and then designate row 1 as a row title for printing.?
Feb 03 2020 12:35 PM
Feb 03 2020 12:37 PM
I can assure you my communication skills only get worse verbally. I am not looking for a row title, as that is already present in my workbook.
Here is a screenshot to visualize.
Here it is now
and here is what I am looking for (notice the 100 in the top left)
I dont want the user to have to edit the header, they edit that cell next to "Doc" and have the header use that cell.
Feb 03 2020 12:57 PM
thinkin I understand now..... researching
Feb 03 2020 10:48 PM
Feb 04 2020 07:31 AM
Feb 04 2020 07:45 AM
Feb 04 2020 09:36 AM
Feb 04 2020 11:29 AM
@Charla74 Thanks so much for the reply. I think I followed your instructions. Here is a screenshot of "ThisWorkbook" and the exact same code is inside "Module1". Does this look correct per your instructions?
Feb 04 2020 11:38 AM
Feb 04 2020 12:49 PM
@Charla74 I printed and got an error:
As for the result, there was nothing printed on the center header :\
First I printed to a PDF, I then printed to a physical printer and both had the same result, no center header.
Feb 04 2020 12:57 PM