|
-
Nov 20th, 2009, 07:40 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] How to have VB6 code modify an EXCEL worksheet?
Hitherto I have always used the ACCESS database, linking to a table through an ADODC control and then linking to that a datagrid. Then I have bound text boxes to the ACCESS table fields. These enable those fields to be read into the program and allow the program to modify the ACCESS database fields back in return. So far so good, and always a reliable procedure.
Now I need to do the same thing with an EXCEL file. Using MS article 257819 plus lot of patient experimentation, I have succeeded in linking an ADODC to the EXCEL file (using Jet 4.0) and linking that ADODC to a datagrid and to a series of databound text boxes. The vital thing was to find out what connection string to use for the ADODC control.
Now two problems arise :
1. The first line of the EXCEL sheet gets "hijacked" by the datagrid and appears as field headers. I do not want this to happen. I wish the fields to be labelled F1, F2, F3 etc. and the first line of the EXCEL sheet to be the first line of the datagrid.
2. The databound text boxes accept changed data, and upon adodc.recordset.movenext those changes are reflected in the datagrid. Thus far exactly as it works with an ACCESS table. However those changes are NOT reflected back into the EXCEL file, and I have failed to find how to achieve this. With an ACCESS table, the source ACCESS database would be updated.
The objectives are :
a. To be able to change the very first row (and others) of the source EXCEL worksheet to different values by use of VB6 at runtime and
b. To be able in all respects to use an EXCEL worksheet with databound text boxes as is possible with an ACCESS table.
I seem to have got this thing very close to working, but not quite.
Hence, comments and suggestions would be much appreciated.
camoore
Wales, UK
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|