Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to copy a cell and horizontally expand the paste along header al7riv Excel Discussion (Misc queries) 7 April 10th 12 02:01 PM
Formula Bar blocks column header letters so I can't paste Clueless in Seattle New Users to Excel 3 November 21st 07 09:50 PM
Excel: custom header - is it possible to paste into header? Maureen D. Excel Worksheet Functions 0 November 4th 05 03:07 PM
how to paste a picture into the header of spreadsheet in Excel 20. Excel programming questions Excel Discussion (Misc queries) 1 February 15th 05 11:33 PM
Need Help - Copy/Paste & Header Row Donnie Stone Excel Programming 3 October 18th 03 01:03 AM


All times are GMT +1. The time now is 02:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"