View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Joel Mills Joel Mills is offline
external usenet poster
 
Posts: 79
Default Align Right footer text to Left

Dude,

I copied both of your procedures. Couldn't get the first to work. Not sure
why. The Line with backslashes is red when pasted. I tried adding the "&L"
to my code and when I do, even though it is RightFooter = when I added the
"&L" to the code it place the input into the left footer not the right
footer.

Since I posted this I've asked another question concering a Chart Title and
input boxes. I modified that code for the Right Footer, but haven't been
able to align to the left. Are you sure that the right footer text can be
aligned left? Below is my code as it stands now. Can it be modified to
align left?

Sub FooterRight()

Dim RightFooter As String, RightStr As String, i As Integer


RightFooter = ""
For i = 1 To 4
RightStr = InputBox("Enter line " & i & " of Chart Title" _
and Hit Enter or Click Okay")
If RightStr < "" Then
RightFooter = RightFooter + RightStr + Chr(10)
Else
Exit For
End If
Next i
With ActiveSheet.PageSetup
RightFooter = RightFooter
If RightFooter < "" Then
' Replace only if there is an entry in RightFooter
.RightFooter = RightFooter
End If
End With

End Sub









"theDude" wrote in
message ...

Hi Joel,

I apologize for omitting that you need to wrap the format code in
quotation marks "&L"...but as I said above, if you use the 'Left-align'
format code in the right footer, it moves the data to the left footer.
Run this code to test it out:

Code:
--------------------
Sub MultiRight3()
Dim RF1 As String
Dim RF2 As String
Dim RF3 As String
Dim RF4 As String

RF1 = InputBox("Enter 1st Line of Footer")
RF2 = InputBox("Enter 2nd Line of Footer")
RF3 = InputBox("Enter 3rd Line of Footer")
RF4 = InputBox("Enter 4th Line of Footer")

With ActiveSheet.PageSetup
.LeftFooter = ""
.CenterFooter = "Center Footer" & Chr(10) & Chr(10) & Chr(10)
.RIGHTFOOTER = \"&L\" & RF1 & CHR(10) & \"&L\" & RF2 & CHR(10) & \"&L\" _
& RF3 & CHR(10) & \"&L\" & RF4
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.65)
.BottomMargin = Application.InchesToPoints(0.87)
.HeaderMargin = Application.InchesToPoints(0.25)
.FooterMargin = Application.InchesToPoints(0.25)
End With
End Sub
--------------------


It's the same as putting your variables in the left footer directly
(this code produces the same result):

Code:
--------------------
Sub MultiRight2()
Dim RF1 As String
Dim RF2 As String
Dim RF3 As String
Dim RF4 As String

RF1 = InputBox("Enter 1st Line of Footer")
RF2 = InputBox("Enter 2nd Line of Footer")
RF3 = InputBox("Enter 3rd Line of Footer")
RF4 = InputBox("Enter 4th Line of Footer")

With ActiveSheet.PageSetup
.LEFTFOOTER = RF1 & CHR(10) & RF2 & CHR(10) & RF3 & CHR(10) & RF4
.CenterFooter = "Center Footer" & Chr(10) & Chr(10) & Chr(10)
.RightFooter = "Right Footer" & Chr(10) & Chr(10) & Chr(10)
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.65)
.BottomMargin = Application.InchesToPoints(0.87)
.HeaderMargin = Application.InchesToPoints(0.25)
.FooterMargin = Application.InchesToPoints(0.25)
End With
End Sub
--------------------


One last bit of info - The total character count for the left, center &
right footer combined is only 255, so you might want to include an error
check to ensure that the total length isn't exceeded since there's 4
prompts that a user can add data...

Hope this helps,
theDude


--
theDude
------------------------------------------------------------------------
theDude's Profile:
http://www.excelforum.com/member.php...o&userid=16550
View this thread: http://www.excelforum.com/showthread...hreadid=382626