raybetts
asked on
VB and Excel 2000
Hi
I need to write some code to essentially do the following:
Open an excel file in VB6
Traverse 2 sheets, taking data from specified cells and loading them into an excel object within vb6
As above, but write / format cells
Save the excel file.
Never really used Excel object model before and it seems a little tough to get to grips with.
Any url's highlighting examples of the above or snippets of code will be much appreciated.
Thanks,
Ray
I need to write some code to essentially do the following:
Open an excel file in VB6
Traverse 2 sheets, taking data from specified cells and loading them into an excel object within vb6
As above, but write / format cells
Save the excel file.
Never really used Excel object model before and it seems a little tough to get to grips with.
Any url's highlighting examples of the above or snippets of code will be much appreciated.
Thanks,
Ray
ASKER
Thanks leon, that helps a lot.
The only other thing I cannot figure out is this:
Last populated column
Last populated row
So that I can loop till last col and row and take the data into a db.
If you know this, then you have the points :-)
The only other thing I cannot figure out is this:
Last populated column
Last populated row
So that I can loop till last col and row and take the data into a db.
If you know this, then you have the points :-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks for the grade,
Leon
Leon
Dim xl As Excel.Application
Dim wkbSource As Excel.Workbook
Dim wshSource As Excel.Worksheet
Dim rngSource As Excel.Range
Set xl = New Excel.Application
xl.Visible = True
Set wkbSource = wl.Workbooks.Open(strPath & strFile)
Set wshSource = wkbSource.Worksheets("Shee
Set rngSource = wshSource.Range("A1")
' And so on
'Don't forget to close all objects the you are done. If you need help with syntax, you can use the Macro recorder in Excel then copy the code into VB and modify it.
Leon