Solved

replacing column headings

Posted on 2014-10-15
6
123 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

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

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

726 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