This is my first time posting anything so please excuse my lack of post formatting. I've been using this forum the past couple of months to help solve small vba issues I've come across while developing a semi-program in excel. It does a bunch of things I'd rather not explain but ive gotten to the point where I need to set the headder and footer for each page on each sheet. I've gotten where I want to place an image in the header to resemble a predetmined header layout but I need to make the first page a differnet picture than all the other pages. I can successfully place an image in the first page that translates to all the others as well as a place one on all the others but not the first. When I turn "PageSetup.DifferentFirstPageHeaderFooter = True" and try to access the second or first page properties exclusively it give me an error stating that the property I'm trying to access is not valid. Below is an example of the part of my code I've having trouble with.
--------------------------------------------------
Sheets(curSheet).PageSetup.DifferentFirstPageHeaderFooter = True
Call GIF_Snapshot(HeaderTemplate.Range("B1:L8")) 'This just ceates a picture in a known location and with a known name that I input into the center header
Sheets(curSheet).PageSetup.TopMargin = Application.InchesToPoints(2.01)
Sheets(curSheet).PageSetup.LeftHeader = ""
Sheets(curSheet).PageSetup.CenterHeader = "&G"
Sheets(curSheet).PageSetup.RightHeader = ""
Sheets(curSheet).PageSetup.CenterHeaderPicture.Filename = "Location\headertemplate.gif"
Sheets(curSheet).PageSetup.RightFooter = "&BFINAL INSPECTION: _________"
Call GIF_Snapshot(HeaderTemplate.Range("B11:L13")) 'Same thing as above but different visual
Sheets(curSheet).PageSetup.Pages(2).LeftHeader = ""
Sheets(curSheet).PageSetup.Pages(2).CenterHeader = "&G"
Sheets(curSheet).PageSetup.Pages(2).RightHeader = ""
Sheets(curSheet).PageSetup.Pages(2).TopMargin.CenterHeaderPicture.Filename = "Location\headertemplate.gif"
Sheets(curSheet).PageSetup.Pages(2).RightFooter = "&BFINAL INSPECTION: _________"
-------------------------------------------------
I've tried accessing different properites and simplifying my code to use a 'with' property but I've just written it out the long way to try to debug. The first chunk of code should work and will place my visual in the header on all pages excep the first. I guess what I'm really looking for is how do I access the header and footer on just the first page to insert a new visual or is this not possible in excel. I know I can use:
Sheets(curSheet).PageSetup.CenterHeader.FirstPage.Text = "Some Text"
but thats text only not a picuture or (&G).
If someone could shed some light on my dilemma I would greatly appreciate it!!
Thanks,
dharnen
--------------------------------------------------
Sheets(curSheet).PageSetup.DifferentFirstPageHeaderFooter = True
Call GIF_Snapshot(HeaderTemplate.Range("B1:L8")) 'This just ceates a picture in a known location and with a known name that I input into the center header
Sheets(curSheet).PageSetup.TopMargin = Application.InchesToPoints(2.01)
Sheets(curSheet).PageSetup.LeftHeader = ""
Sheets(curSheet).PageSetup.CenterHeader = "&G"
Sheets(curSheet).PageSetup.RightHeader = ""
Sheets(curSheet).PageSetup.CenterHeaderPicture.Filename = "Location\headertemplate.gif"
Sheets(curSheet).PageSetup.RightFooter = "&BFINAL INSPECTION: _________"
Call GIF_Snapshot(HeaderTemplate.Range("B11:L13")) 'Same thing as above but different visual
Sheets(curSheet).PageSetup.Pages(2).LeftHeader = ""
Sheets(curSheet).PageSetup.Pages(2).CenterHeader = "&G"
Sheets(curSheet).PageSetup.Pages(2).RightHeader = ""
Sheets(curSheet).PageSetup.Pages(2).TopMargin.CenterHeaderPicture.Filename = "Location\headertemplate.gif"
Sheets(curSheet).PageSetup.Pages(2).RightFooter = "&BFINAL INSPECTION: _________"
-------------------------------------------------
I've tried accessing different properites and simplifying my code to use a 'with' property but I've just written it out the long way to try to debug. The first chunk of code should work and will place my visual in the header on all pages excep the first. I guess what I'm really looking for is how do I access the header and footer on just the first page to insert a new visual or is this not possible in excel. I know I can use:
Sheets(curSheet).PageSetup.CenterHeader.FirstPage.Text = "Some Text"
but thats text only not a picuture or (&G).
If someone could shed some light on my dilemma I would greatly appreciate it!!
Thanks,
dharnen