VBA Footer Horizontal Line

tgizmo

New Member
Joined
Jul 9, 2010
Messages
7
How would I add a horizontal line at the top of this footer? I tried adding "String(100, "_") &" to the beginning of the .LeftFooter but it's not working.

Thanks for helping... Here's the full code.

Sub SetFooter()
' custom footer

Dim wb As Workbook
Dim wsProfile As Worksheet
Dim strCompany As String
Dim strAddress As String
Dim strCity As String
Dim strZip As String
Dim strContact As String
Dim strEmail As String
Dim strTel As String

Set wb = ThisWorkbook
Set wsProfile = wb.Sheets("Employer Profile")

strCompany= wsProfile.Range("pCompany").Value
strAddress = wsProfile.Range("pAddress").Value
strCity = wsProfile.Range("pCity").Value
strZip = wsProfile.Range("pZip").Value
strContact = wsProfile.Range("pContact").Value
strEmail = wsProfile.Range("pEmail").Value
strTel = Format(wsProfile.Range("pTel").Value, "###"".""###"".""####")

With ActiveSheet.PageSetup
.LeftFooter = _
' tried "String(100,"_") & "&08" & Space(10) & "&B" & strCompany & "&B" & Chr(10) & _" as next line but it does not work
"&08" & Space(10) & "&B" & strCompany& "&B" & Chr(10) & _
Space(10) & strAddress & Chr(10) & _​
Space(10) & strCity & ", TX " & strZip & "&08"​
.CenterFooter = ""
.RightFooter = _
"&08" & strContact & Chr(10) & _
strEmail & Chr(10) & _​
strTel & "&08"​

End With
End Sub
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi

Unfortunately I don't know how to do it directly editing the footer, I don't even think it's possible.


In case you want to try the solution I usually use, that works great but is not straightforward, this is what I do:

- I insert a horizontal line in the worksheet the width of the page
- copy the line
- paste in a graphic program
- save the line as a graphic file
- go back to excel, left footer, insert picture, browse for the file and insert it
- press enter after the picture code

.. and then edit the left, centre and right footer with the text I need

This places the line at the top of the footer and works great.
 
Upvote 0
Thanks. I've done this but thought there might be a way to do it with String(100, "_") but ??.
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,591
Members
449,174
Latest member
chandan4057

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top