Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Paste text into a header
I am trying to paste text into a header via code. I can't get it
working. Anyone? Regards, Danny |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Paste text into a header
How do you get the text?
Are you talking of a header on the worksheet or about a header in the print set-up? you can use Range("A1")=Range(D25) or Range("A1")=InputBox ("Enter a Header") or Range("A1")="My Header" -- steveB Remove "AYN" from email to respond "Danny Springer" wrote in message ... I am trying to paste text into a header via code. I can't get it working. Anyone? Regards, Danny |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Paste text into a header
STEVE BELL wrote:
How do you get the text? Are you talking of a header on the worksheet or about a header in the print set-up? I am talking about a header in the print set-up. If I record a macro and paste my text, I will find the text in my macro, not the command "paste". Regards, Danny |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Paste text into a header
Below is code I recorder, and below it is after editing it...
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 ======================================== -- steveB Remove "AYN" from email to respond "Danny Springer" wrote in message ... STEVE BELL wrote: How do you get the text? Are you talking of a header on the worksheet or about a header in the print set-up? I am talking about a header in the print set-up. If I record a macro and paste my text, I will find the text in my macro, not the command "paste". Regards, Danny |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Paste text into a header
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 ======================================== |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 ======================================== |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Paste text into a header
STEVE BELL wrote:
The text on the clipboard is coming from a copied source. Yes, but it's coming from another program. 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? No, you were clear, but I solved it, I first paste the text to a cell and read it in a variable exactly as you told me. I was only very surprised that I could not use the Paste command as I am used for a long time with Word. But thank you for sending me to this direction. Danny |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to copy a cell and horizontally expand the paste along header | Excel Discussion (Misc queries) | |||
Formula Bar blocks column header letters so I can't paste | New Users to Excel | |||
Excel: custom header - is it possible to paste into header? | Excel Worksheet Functions | |||
how to paste a picture into the header of spreadsheet in Excel 20. | Excel Discussion (Misc queries) | |||
Need Help - Copy/Paste & Header Row | Excel Programming |