Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Former Member Absent Member.
Absent Member.
327 views

[archive] Setting the Heading and Footer When Exporting Information to Excel 2007

[Migrated content. Thread originally posted on 11 April 2007]

I am exporting data to Excel using the Application, Workbook, Worksheet and Range objects. I was able to set the Header and Footers for the current version of Excel(2003) that I have on my computer. The code that I am using is

MODIFY EX-WORKSHEET @PageSetup::LeftHeader = GUI-HEADER-TITLE.
MODIFY EX-WORKSHEET @PageSetup::LeftFooter = FOOTER-DATE.
MODIFY EX-WORKSHEET @PageSetup::CenterFooter = PROJECT-NAME.
MODIFY EX-WORKSHEET @PageSetup::RightFooter = %P.

So currently when I do the export to Excel and print the Excel spreadsheet, it will print the header and footers correctly.

Now I just tested this on Excel 2007 and I get an error when my program hits the above code and will not continue with the export to Excel. According to the online documentation on the MSDN website about Excel 2007, the PageSetup property is part of the Worksheet Object, so I am not sure why I am getting an error? Error I am gettting is "Unable to set the LeftHeader property of the PageSetup class". I am new to doing the export to Excel this way, so maybe it is just something that I don't understand.


Does anyone have any ideas?
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.