How do I get the value of the cells in an Excel (xlsx) sheet header using automation. I can open and read the rows and columns OK, but not the header info.
Thanks Mike. No, I can get the sheet name just fine. When I open the xlsx file manually there is a section above row 1 labeled Header that has text in it. Please see attached file. I tried Row 0 with no luck and I can't find any reference as to how to read this info with my google searches. I've some info about turning Headers on/off, but not in automation for reading purposes.
That's not the issue. I apologize for the bad screen print, I should have included the row numbers. Row 1 is the row with "SELLER NAME". It's the information above row 1 that I need. I found this that will give me the header info I was looking for.
Code:
oExcel.ActiveSheet.PageSetup.LeftHeader
This link explains the header and footer properties and how to read them.
Auguy,
Did you solve this?
The information in Excel is in the Page Setup area (Headers and footers are not part of the visible sheet, you can only see them at print or print/preview time). Each sheet can have it's own, and up to 3 of them: left, center and right. Same with footer.
The center is most commonly used for text to label the page when it's printed. Right and left frequently have logo or date fields.
Best Regards,
Scott
ATS, CDCE, CTIA, CTDC
"Everything should be made as simple as possible, and no simpler."
Yes I did thanks. See my post from time "19:36" above. Funny, when I open the file I see the Headers all of the time, but I did not create this file so I'm not sure what they did if this is not the default for displaying the sheets.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.