Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

column headers in Excel 1

Status
Not open for further replies.

peter37

Programmer
Jan 20, 2006
10
CA
hi,
i'm exporting to excel data cursor from vfp9 application:
loExcel.Cells(RecNo(),lnI).Value = lValueToInsert

also i'd like to be able to name column headers but having a hard time to find syntax to do so.
thanks for any help.
 
Not sure what you mean by "name column headers", but if you know how to do it in Excel, just record an Excel macro to do it and look at the VB code that gets generated. Should give you everything you need.

Regards,
Jim
 

Peter,

You can't change the column headers in Excel, but you can insert your own header text in the first row. The code would be something like this:

oExcel.Cells(1,lnI).Value = cMyHeaderText

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
thanks a lot Mike, i am just amazed how much work you've done over the years and stil do ...
 
While Mike's suggestion is, in general, the best one and certainly the most flexible, there is an alternative approach if your Row1 (header) values are changing.

I manually create a fixed Header.xls file in Excel and store it in a known disk location. This need only be done once per Header file.

Within the VFP application I use Excel Automation to create the new Excel data file.
After that, I merely use Excel Automation to Insert a new Row1 and copy Header.xls into the new Row1 of the new data file.

That is reasonably easy to accomplish and minimizes the Excel Automation code required.

Good Luck,
JRB-Bldr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top