Save figure table to Excel file
I have Table contait fields Firstname and LastName, I wanna Access to this
table and save to Excel file,
First row save to Sheet A1 for FirstName, A2 for LastName
Second row save to B1 for Firstname, B2 for LastName
and soon ..
Does any one know how to do this, please give me a sample code
Thank you for you help
One more, Can I Save formula as say to Sheet A9 with A1+A1
Re: Save figure table to Excel file
First set a reference to the Microsoft Excel Object Library then add the following:
Dim xl as Excel.Application
Dim wkb as Excel.Workbook
Dim wks as Excel.worksheet
Set xl = new Excel.Application
If xl.workbooks.count = 0 then xl.workbooks.add
set wkb = xl.workbooks(1)
if wkb.worksheets.count = 0 then xl.worksheets.add
set wks = wkb.worksheets(1)
' Open your recordset here.
wks.range("A1") = rs(0)
wks.range("B1") = rs(1)
wks.range("C1").NumberFormula = "=A1+B1"
' etc . . .
The lines that check the count properties are sort of overkill. Almost everyone
has Excel set to open with a workbook/worksheet already available but everyone
once in a while you'll run into someone who doesn't.
Keep in mind that I wrote that off the top of my head so there may be a syntax
error or two. In particular I'm pretty sure that the workbooks and worksheets
collections are 1-based but you might need to start at 0.
"Mahendra Gunawan" <email@example.com> wrote:
>I have Table contait fields Firstname and LastName, I wanna Access to this
>table and save to Excel file,
>First row save to Sheet A1 for FirstName, A2 for LastName
>Second row save to B1 for Firstname, B2 for LastName
>and soon ..
>Does any one know how to do this, please give me a sample code
>Thank you for you help
>One more, Can I Save formula as say to Sheet A9 with A1+A1
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center