Solved

replacing column headings

Posted on 2014-10-15
6
124 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
[X]
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
  • 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

Author Comment

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

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

688 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