Solved

replacing column headings

Posted on 2014-10-15
6
111 Views
Last Modified: 2014-10-15
HI: I am moving from a manual export process( sql to crystal to excel) to an automated sql to foxpro to excel export.
Problem is that foxpro truncates column headings to 10 characters. My user is moaning that he needs the full heading 'like it was'. Apart from telling him to get real , does anybody know of a way of replacing the heading (top)  row of data in an automatically produced excel sheet (ie not a template or pre existing document) with an array of other, fixed, data (eg replace  cell a1 "line_price" with "line price net of vat"). I then need to email the document so ideally get it all to happen in one process. Thanks!
0
Comment
Question by:ClaytonGlass
  • 3
  • 2
6 Comments
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40381679
Plenty of ways, but I think you need to be more specific.

For instance, are the headings going to be fixed, or do you need a Find and Replace function?

A bit more detail is needed.
0
 

Author Comment

by:ClaytonGlass
ID: 40381741
Thanks for the swift response!
OK - the layout of the sheet will be fixed, so the array can be fixed too. I do not want to actually open the excel doc; I would hope to write a VB script or similar that ran from within foxpro.  The client imports the excel sheet into Access so he is wanting the mapping to be unaffected. I have done everything else - but the actual text of the heading stumps me!
I have done similar with csv where I had a file with just a single row of set data , then with the target file  I stripped out the first row and appended the row from the substitute file.  It is if an excel doc (excel 2007) would allow me to handle it in the same way!
Thanks again
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40381745
Sorry - I don't know VBS.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:ClaytonGlass
ID: 40381751
No problem - thanks for your interest!
0
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40381812
Hi,

Maybe

Set objExcel = CreateObject("Excel.Application") 
strPathExcel = "C:\Script\Test\Xls\scopes.xls" 
objExcel.Workbooks.Open strPathExcel 
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1) 
objSheet.Cells(1, 1).Value = “Header1”
objSheet.Cells(1, 2).Value = “Header2”
objSheet.Cells(1, 3).Value = “Header3”
objSheet.Cells(1, 4).Value = “Header4”
objExcel.ActiveWorkbook.Save 
objExcel.Workbooks.Close 
objExcel.Application.Quit 

Open in new window

Regards
0
 

Author Closing Comment

by:ClaytonGlass
ID: 40381848
Sounds like a plan! Thank you very much!
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now