Writing values to already existing worksheet
I already have an Excel worksheet. How do开发者_如何转开发 I write some values to that worksheet from my VB application?
Note: This is an Excel-VBA solution; however, someone has changed the question tag to VB.NET since.
Sub MySub()
Set xlApp = CreateObject("Excel.application")
xlApp.Visible = True
Set xlBook = xlApp.Workbooks.Open("C:\MyBook.xls")
Set xlSheet = xlBook.ActiveSheet
xlSheet.Range("A1").Value = "Hello, world!"
End Sub
精彩评论