开发者

Writing values to already existing worksheet

开发者 https://www.devze.com 2023-02-22 23:41 出处:网络
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 t

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
0

精彩评论

暂无评论...
验证码 换一张
取 消