Write to Excel
Posted on 2008-06-09
I have a tamplate in Excel 2007. Column "A" is Firstname and column "B" is Lastname , and column "C" is Address. I have no problem getting data from DB. All I want to find out is how can I use my template and fill it out and save it to a new file.
column A column B Column C
FirstName | LastName | Address
Tim Johnsone 123 Test st. San Francisco, Ca 90000
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim xlApp As New Excel.Application
Dim wrkbook As Excel.Workbooks
wrkbook = xlApp.Workbooks.Open("mypath\test.xlsx")
xlApp.Range("A" & 1).Value = "Tim"
xlapp.range("B" & ???????????????
wrkbook = Nothing
xlApp = Nothing