ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Leftaligning text in right header (https://www.excelbanter.com/excel-programming/291301-leftaligning-text-right-header.html)

PO

Leftaligning text in right header
 
Hi

I'm extracting invoicedata from a database into a worksheet
I want to leftalign the pagenumber and invoicenumber in the right header in
pagesetup of the worksheet. Each time the user retrieves the invoicedata I
use the following code to set the right header for the worksheet:

Sub SetHeader
....
with activesheet.pagesetup
.rightheader = "Page" & _
Chr(10) & "&P(&N)" & _
Chr(10) & "Invoicenr" & _
Chr(10) & strInvNr
end with
End sub

If I place the text in the right header, however, the text right aligns.
I've tried to place the text in the left header and use the string function:

with activesheet.pagesetup
.leftheader = string(165, " ") & "Page" & _
string(165, " ") & Chr(10) & "&P(&N)" & _
string(165, " ") & Chr(10) & "Invoicenr" & _
string(165, " ") & Chr(10) & strInvNr
end with

This doesn't work since you only can place up to 254 characters in one
header.
I use Excel 2000.

Any ideas?

TIA
PO



Tom Ogilvy

Leftaligning text in right header
 
pad the right header with spaces?

--
Regards,
Tom Ogilvy

"PO" <po wrote in message ...
Hi

I'm extracting invoicedata from a database into a worksheet
I want to leftalign the pagenumber and invoicenumber in the right header

in
pagesetup of the worksheet. Each time the user retrieves the invoicedata I
use the following code to set the right header for the worksheet:

Sub SetHeader
...
with activesheet.pagesetup
.rightheader = "Page" & _
Chr(10) & "&P(&N)" & _
Chr(10) & "Invoicenr" & _
Chr(10) & strInvNr
end with
End sub

If I place the text in the right header, however, the text right aligns.
I've tried to place the text in the left header and use the string

function:

with activesheet.pagesetup
.leftheader = string(165, " ") & "Page" & _
string(165, " ") & Chr(10) & "&P(&N)" & _
string(165, " ") & Chr(10) & "Invoicenr" & _
string(165, " ") & Chr(10) & strInvNr
end with

This doesn't work since you only can place up to 254 characters in one
header.
I use Excel 2000.

Any ideas?

TIA
PO





PO

Leftaligning text in right header
 
Since I use font Arial the text never leftaligns a 100%.

Regards,
PO

"Tom Ogilvy" wrote in message
...
pad the right header with spaces?

--
Regards,
Tom Ogilvy

"PO" <po wrote in message ...
Hi

I'm extracting invoicedata from a database into a worksheet
I want to leftalign the pagenumber and invoicenumber in the right header

in
pagesetup of the worksheet. Each time the user retrieves the invoicedata

I
use the following code to set the right header for the worksheet:

Sub SetHeader
...
with activesheet.pagesetup
.rightheader = "Page" & _
Chr(10) & "&P(&N)" & _
Chr(10) & "Invoicenr" & _
Chr(10) & strInvNr
end with
End sub

If I place the text in the right header, however, the text right aligns.
I've tried to place the text in the left header and use the string

function:

with activesheet.pagesetup
.leftheader = string(165, " ") & "Page" & _
string(165, " ") & Chr(10) & "&P(&N)" & _
string(165, " ") & Chr(10) & "Invoicenr" & _
string(165, " ") & Chr(10) & strInvNr
end with

This doesn't work since you only can place up to 254 characters in one
header.
I use Excel 2000.

Any ideas?

TIA
PO







Tom Ogilvy

Leftaligning text in right header
 
If you were willing to try to pad it from the left, and that doesn't work,
then the next step it to pad it from the right.

Seems like working 100% is relative. You won't be able to absolutely locate
it on the sheet - unless someone else has the better suggestion.

--
Regards,
Tom Ogilvy

"PO" <po wrote in message ...
Since I use font Arial the text never leftaligns a 100%.

Regards,
PO

"Tom Ogilvy" wrote in message
...
pad the right header with spaces?

--
Regards,
Tom Ogilvy

"PO" <po wrote in message ...
Hi

I'm extracting invoicedata from a database into a worksheet
I want to leftalign the pagenumber and invoicenumber in the right

header
in
pagesetup of the worksheet. Each time the user retrieves the

invoicedata
I
use the following code to set the right header for the worksheet:

Sub SetHeader
...
with activesheet.pagesetup
.rightheader = "Page" & _
Chr(10) & "&P(&N)" & _
Chr(10) & "Invoicenr" & _
Chr(10) & strInvNr
end with
End sub

If I place the text in the right header, however, the text right

aligns.
I've tried to place the text in the left header and use the string

function:

with activesheet.pagesetup
.leftheader = string(165, " ") & "Page" & _
string(165, " ") & Chr(10) & "&P(&N)" & _
string(165, " ") & Chr(10) & "Invoicenr" & _
string(165, " ") & Chr(10) & strInvNr
end with

This doesn't work since you only can place up to 254 characters in one
header.
I use Excel 2000.

Any ideas?

TIA
PO









Rob van Gelder[_4_]

Leftaligning text in right header
 
You could change the font size to something massive, like 72 point, which
makes the spaces you use cover more space.
Then after the spaces, return the font size to standard 10 point (or
whatever you're using).

"&48" & String(25, " ") & "&10Page"


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"PO" <po wrote in message ...
Hi

I'm extracting invoicedata from a database into a worksheet
I want to leftalign the pagenumber and invoicenumber in the right header

in
pagesetup of the worksheet. Each time the user retrieves the invoicedata I
use the following code to set the right header for the worksheet:

Sub SetHeader
...
with activesheet.pagesetup
.rightheader = "Page" & _
Chr(10) & "&P(&N)" & _
Chr(10) & "Invoicenr" & _
Chr(10) & strInvNr
end with
End sub

If I place the text in the right header, however, the text right aligns.
I've tried to place the text in the left header and use the string

function:

with activesheet.pagesetup
.leftheader = string(165, " ") & "Page" & _
string(165, " ") & Chr(10) & "&P(&N)" & _
string(165, " ") & Chr(10) & "Invoicenr" & _
string(165, " ") & Chr(10) & strInvNr
end with

This doesn't work since you only can place up to 254 characters in one
header.
I use Excel 2000.

Any ideas?

TIA
PO






All times are GMT +1. The time now is 07:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com