I have created an application, which generates a pivot table in excel.
yet there is no problems in module, time came I have to release it to all cities of my organization.
I inserted a code in my module to write headers and footers which will display my name with my department on footers.
It prints this info when a document is printed.
PROBLEM IS HERE:
Some (so called) advance excel users delete the footers before printing the document. and me and my department loos the credit of that report.
So I found the solution that "the Workbook_BeforePrint event" will serve the purpose. But my knowledge allows me to copy paste the code in this place in existing excel file manually.
When my application get released all over country, we do not have control over Excel files created and so can not insert this code this way.
EXPECTED SOLUTION:
If any one can guide how do i insert below code in the "Workbook_BeforePrint" event by using another VB or VFP code (ie programmatically)
Expand|Select|Wrap|Line Numbers
- With xl.ActiveSheet.PageSetup
- .LeftHeader = "&D&T"
- .CenterHeader = ""
- .RightHeader = "&F"
- .LeftFooter = ""
- .CenterFooter = ""
- .RightFooter ="MisAviPivot:Designed & Developed by" + Chr(10) + "Harshad D. - CorporateIT / "
- .LeftMargin = Application.InchesToPoints(0.75)
- .RightMargin = Application.InchesToPoints(0.50)
- .TopMargin = Application.InchesToPoints(0.75)
- .BottomMargin = Application.InchesToPoints(0.75)
- .HeaderMargin = Application.InchesToPoints(0.5)
- .FooterMargin = Application.InchesToPoints(0.5)
- .PrintHeadings = False
- .PrintGridlines = False
- .PrintComments = xlPrintNoComments
- .PrintQuality = 600
- .CenterHorizontally = False
- .CenterVertically = False
- .Orientation = xlPortrait
- .Draft = False
- .PaperSize = xlPaperA4
- .FirstPageNumber = xlAutomatic
- .Order = xlDownThenOver
- .BlackAndWhite = False
- .Zoom = 100
- EndWith