Happy I could help Taufik.
Not sure I can answer this current question, but
I do seem to recall reading, somewhere, that there
was a way to combine the top row of cells on the
Excel Sheet to make one long cell, for a title/caption.
Then again, I may be confusing Word with Excel < g >
In re-reading your question, maybe I got it wrong
the first time around. Do you want to use something
else besides the Access Table Field Names in Excel ?
Do you want to make your own Column Names and place them ?
We could do that by filling a 1-D array with
the names we have created and placed into the array:
Name the array 'ColumnNames( )'
' Make the column headers.
For col = 0 To rs.Fields.Count - 1
excel_sheet. Cells(1, col + 1) = ColumnNames( col)
Next col
...or do I still not see the problem correctly ?
Thanks,
Steve
'
Sent Out Around
17:35 EST on Wednesday, March 26, 2008
'
____________ _________ _________ _________ _
From: helpwithvb
yahoogro ups.com
[mailto:helpwithvb
yahoogro ups.com] On Behalf Of Taufik Mansur
Sent: Wednesday, March 26, 2008 12:30 AM
To: helpwithvb
yahoogro ups.com
Subject: Re: [helpwithvb] Exporting Access table to Excel Using VB6
Dear Steve,
Thanks a lot Steve. As usual, your guidance help me solve my problem.
One more question if you don't mind, how to make the header in the spread
sheet instead of field name, become the caption property of the access
database field name.
Here is the statement for the header (but using field name) quote from the
sample program :
' Make the column headers.
For col = 0 To rs.Fields.Count - 1
excel_sheet. Cells(1, col + 1) = rs.Fields(col) .Name
Next col
Thanks again for your kind help.
Regards
Taufik Mansur
----- Original Message ----
From: Steve Manser <smanser
twcny. rr.com>
To: helpwithvb
yahoogro ups.com
Sent: Tuesday, March 25, 2008 10:13:51 AM
Subject: RE: [helpwithvb] Re:Exporting ACcess table to Excel Using VB6
>> "Can I move the data directly from Access into Excel ?"
Yes we can. Here is a sample / example project for download:
http://vb-helper. com/index_ office.html
to...
http://vb-helper. com/index_ office.html# access
and then....
http://vb-helper. com/howto_ access_to_ excel.html
and also...
http://vb-helper. com/howto_ access_to_ excel_2.html
------------ -
>> "..any advise on how to fill the Flexgrid ?"
Yes.
In this group's Files Section there are some VB-6 examples.
At least one is very basic, no extra fluff, and with the
included comments it should be well explained, and may
also include some 'best programming practices'.
If I recall, even I could follow along in the comments.
Also, in the Excel spread sheet we can do a 'Save-As CSV' file.
All The Best,
Steve
____________ _________ _________ _________ _
From: helpwithvb
yahoogro ups.com
[mailto:helpwithvb
yahoogro ups.com] On Behalf Of Anthony Padua
Sent: Monday, March 24, 2008 12:52 PM
To: helpwithvb
yahoogro ups.com
Subject: [helpwithvb] Re: Exporting Access table to Excel Using VB6
Write it as a file with the extension .csv Use commas as column seperators,
and carriage returns as row separators. Suppose you have a flexgrid by the
name of grid:
Open app.path & "myfile.csv" for output as 1
for row = 1 to grid.rows
for column = 1 to grid.cols
print #1, grid.textmatrix( row, column) & "," 'comma separates
columns
print #1, vbcrlf 'carriage return tells it
'that it's at end of row
next column
next row
close
Now the spreadsheet can be opened and read by anyone.
.