By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,285 Members | 1,647 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,285 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.