Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27311

VB.net to Excel

$
0
0
I am trying to get an existing Excel workbook from a file and working on it.

I need to specify a path to the file.

"GetObject" may not be compatible with "Open"

I did set the Reference to Microsoft Excel 14.0.

Code:

        Dim xlApp As Microsoft.Office.Interop.Excel.Application
        Dim xlBook As Microsoft.Office.Interop.Excel.Workbook
        Dim xlSheet As Microsoft.Office.Interop.Excel.Worksheet
        xlApp = GetObject(, "Excel.Application")
        xlBook = xlApp.open("C:\path\file.xls")
        xlSheet = xlBook.Worksheets(1)
        xlSheet.Activate()


Viewing all articles
Browse latest Browse all 27311

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>