LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Margins control to VBA code


I need some help. The code below populates the header and footer
information from cells on what I named the header page.

I need this code to also adjust the top margin to 1.44" on the sheet
when the header is updated.

Thanks in advance!


Sub SetHeader(sh As Worksheet)
Dim lStr As String
Dim rStr As String
Dim dStr As String

With Worksheets("HeaderPage")

lStr = .Range("J2") & vbCr & .Range("J3") & vbCr &
..Range("J4")
rStr = .Range("M2") & vbCr & .Range("M3") & vbCr & .Range("M4")
& vbCr & .Range("M5") & vbCr & .Range("M6")
dStr = "&6" & Range("W1") & vbCr & .Range("W2") & vbCr &
..Range("W3") & vbCr & .Range("W4")
End With

With sh.PageSetup
..LeftHeader = lStr
..RightHeader = rStr
..CenterFooter = dStr


End With
End Sub


--
retseort
------------------------------------------------------------------------
retseort's Profile: http://www.excelforum.com/member.php...o&userid=24690
View this thread: http://www.excelforum.com/showthread...hreadid=481889

 
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 put margins on a text book from the excel control toolbox? Amy Excel Discussion (Misc queries) 2 May 23rd 07 02:31 AM
I am not able to control the margins. Dick T Excel Discussion (Misc queries) 1 May 3rd 06 11:20 PM
Changing control properties/code through code Ajit Excel Programming 3 October 18th 04 09:03 PM
runtime Control and code in VBA Anu Excel Programming 1 January 12th 04 04:44 AM
can you control SAP with VBA code? robin Excel Programming 0 October 9th 03 06:40 PM


All times are GMT +1. The time now is 12:42 PM.

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

About Us

"It's about Microsoft Excel"