List Info

Thread: Re: Exporting Access table to Excel Using VB6




Re: Exporting Access table to Excel Using VB6
country flaguser name
United States
2008-03-26 22:50:08


Thanks again Steve.

Actually in my access database table,for the field name, I also fill the caption property, so when  I access this table from access directly/manually,  the field ; name  display the caption,instead of the field name.

This is what I want to be happen also for the field name header,when excel takes the access data through the vb6 programming,by replace the field name with the caption property instead of the field name.

Regards

Taufik Mansur




----- Original Message ----
From: Steve Manser <smansertwcny.rr.com>
To: helpwithvbyahoogroups.com
Sent: Thursday, March 27, 2008 4:36:52 AM
Subject: RE: [helpwithvb] Exporting Access table to Excel Using VB6


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: helpwithvbyahoogro ups.com
[mailto:helpwithvbyahoogro ups.com] On Behalf Of Taufik Mansur
Sent: Wednesday, March 26, 2008 12:30 AM
To: helpwithvbyahoogro ups.com
Subject: Re: [helpwithvb] Exporting Access table to Excel Using VB6

Dear Steve,

Thanks a lot Steve.&nbsp; 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 :

&nbsp;' Make the column headers.
 &nbsp; 
 &nbsp; For col = 0 To rs.Fields.Count - 1
   ; &nbsp; &nbsp; excel_sheet. Cells(1, col + 1) = rs.Fields(col) .Name
&nbsp; &nbsp; Next col

Thanks again for your kind help.

Regards

Taufik Mansur

----- Original Message ----
From: Steve Manser <smansertwcny. rr.com>;
To: helpwithvbyahoogro ups.com
Sent: Tuesday, March 25, 2008 10:13:51 AM
Subject: RE: [helpwithvb] Re:Exporting ACcess table to Excel Using VB6

&gt;> "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: helpwithvbyahoogro ups.com
[mailto:helpwithvb yahoogro ups.com] On Behalf Of Anthony Padua
Sent: Monday, March 24, 2008 12:52 PM
To: helpwithvbyahoogro 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
 &nbsp; &nbsp; for column = 1 to grid.cols
 &nbsp;   &nbsp; &nbsp;  print #1, grid.textmatrix( row, column) & ","  'comma separates
columns
 &nbsp;   &nbsp; &nbsp;  print #1, vbcrlf&nbsp; 'carriage return tells it
'that it's at end of row
&nbsp; &nbsp; next column
next row

close

Now the spreadsheet can be opened and read by anyone.

.




Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )