Private Sub Workbook_BeforePrint(Cancel As Boolean)
dim myName as string
myName = me.name
worksheets("Somesheetnamehere").PageSetup.CenterHeader _
= right(myname,len(myname)-4)
End Sub
I used the Me keyword--it refers to the object that owns the code. In this
case, it's the workbook that's being printed.
And I only changed a specific worksheet--not the activesheet.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.