Paste text into a header
The text on the clipboard is coming from a copied source.
you could just set a string variable = to the source.
(and this avoids selecting, copying, pasting)
that's what I alluded to when I said:
Replace the text with a cell reference, a text reference, a result
from an InputBox or form, or a variable.
Or have I gotton confused?
Dim str As Text
str = Range("A1")
With ActiveSheet.PageSetup
..LeftHeader = str
End With
--
steveB
Remove "AYN" from email to respond
"Danny Springer" wrote in message
...
STEVE BELL wrote:
Below is code I recorder, and below it is after editing it...
Ok, that is exactly what I already did, but I need to paste text from the
clipboard, not a fixed text. Any idea?
Thanks,
Danny
Replace the text with a cell reference, a text reference, a result
from an InputBox or form, or a variable.
==========================
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = "Left Header"
.CenterHeader = "Center Header"
.RightHeader = "Right Header"
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
End With
================================
With ActiveSheet.PageSetup
.LeftHeader = "Left Header"
.CenterHeader = "Center Header"
.RightHeader = "Right Header"
End With
========================================
|