Solved

replacing column headings

Posted on 2014-10-15
6
119 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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

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

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
.Range Set 25 78
remove dups 10 37
how to transpose my example data using VBA 9 35
Excel highlight a cell based on input from another cell 3 14
As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

832 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