Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

replacing column headings

Posted on 2014-10-15
6
120 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA Vbscript  Issue 9 25
Excel formula - data format 5 17
Save and close already open Excel file using VBscript 9 48
excel conditional formating 4 15
A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
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…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

839 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