Can Page Setup values be controlled with VBA?

  • Thread starter Thread starter TBA
  • Start date Start date
T

TBA

My Network Administrator where I work asked me if I could put the date that
a worksheet was last changed in the footer of a printout. I don't work with
print settings with VBA at all, so I'm a little unsure here. Similarly, can
this be done in MS Word?

TIA

-gk-
 
Using Excel

Put this code in the Thisworkbook code module

Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet
.PageSetup.RightFooter = "Document last saved on " & _
Format(ActiveWorkbook.BuiltinDocumentProperties("Last Save Time"), _
"dd mmm yyyy")
End With
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Beautiful! Thanks Bob!

-gk-

Bob Phillips said:
Using Excel

Put this code in the Thisworkbook code module

Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet
.PageSetup.RightFooter = "Document last saved on " & _
Format(ActiveWorkbook.BuiltinDocumentProperties("Last Save Time"), _
"dd mmm yyyy")
End With
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top