473,382 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Exporting to excel csv and how to set the cell to wrap text

Hi there,

1) I is there a more elegant way, more professionally way this export could
done, as I have written some code for the first time?
2) who could I wrap text cell a1 a3 via code ?
3) is there a tutorial whereas I refresh my knowledge?

and here goes the code

Regards

Norman
'Start of snippet

Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim strcount, strdate, Strnewfile, strCSVFILE As String

Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = False
Set xlBook = xlApp.Workbooks.Open(filename:=strCSVFILE)

Set xlSheet = xlBook.ActiveSheet

Set xlSelection = xlSheet.Range(xlSheet.Cells(1, 1), xlSheet.Cells(1,
1).End(xlToRight))

Set xlSelection = xlSheet.Range("A1")
xlSheet.Range("A1").Value = "Report Coverage" _
& " National Program" _
& " Results for Period 4th August - " & strdate & " " & Format(Date,
"mmmm yyyy") & "."
Set xlSelection = xlSheet.Range("A3")
xlSheet.Range("A3").Value = "This report reflects data received by the "
_
& "xxxxxxxx department" & Format(Now(), "h ampm") _
& " " & Format(Now(), "dddd") & strdate & " " & Format(Now(), "mmmm,
yyyy") & "." & _
" Data is provisional and subject to ongoing revision and review."

Set xlSelection = xlSheet.Range("A5")
xlSheet.Range("A5").Value = "AHS"
Set xlSelection = xlSheet.Range("B5")
xlSheet.Range("B5").Value = "Total Number of Targetgroup" & _
" Aged 15 - 19 Year Group"
Set xlSelection = xlSheet.Range("C5")
xlSheet.Range("C5").Value = "Total Number of Targetgroup" & _
" of Other Ages"
Set xlSelection = xlSheet.Range("D5")
xlSheet.Range("D5").Value = "Total Number of Targetgroup"
' end of snippet

Nov 12 '05 #1
0 3182

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: sridevi | last post by:
Hello How to export data from ms-access database to excel worksheet using ASP. mainly i need to export data to multiple worksheets. it is very urgent to us. i have a sample code which works...
4
by: D | last post by:
I've created a report with many subreports of aggregate data. I want my client to be able to export this data to Excel to make her charts, etc. Only one problem: one of the fields is a "SchoolYear"...
2
by: G | last post by:
When I export data from access to excel by with "export" or "Analyze with" I seem to loose parts of some fields (long text strings). Is there a way to export it all to excel? Thanks G
4
by: searider86 | last post by:
Does anyone know if there is a snippet of code that automatically removes the wrap text format in excel? I have an access form that displays data and allows the user to click on a cmdbutton to...
0
by: Carlos Lozano | last post by:
Hi, I have an application that creates Excel files and I ma having trouble formatting cells. I fill all cells required, sewt fonts and everything, but have a cell that contains multiple text...
6
by: Kevin Humphreys | last post by:
Hi There, I am trying to export a recordset to an excel file using the Content Type below in the header. Response.ContentType = "application/vnd.ms-excel" Which works fine however the...
6
by: McKirahan | last post by:
I an using ASP to read a database table and generate an HTML table which is save via FSO with a file extension of .xls which opens up in MS-Excel. I am inserting several lines of text into a cell...
2
by: Brian Parker | last post by:
I need to format text in cell in an Excel worksheet and I need to do this using C#. I've seen code that will set the format for the whole cell, but I just need to format one character in that...
2
by: JimmyKoolPantz | last post by:
We purchased som software for encoding a barcode. We want to automate the process of converting a number to a readable barcode. However, I am having a few issues. The file that the barcode...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.