ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Reference using Excel with VB.NET (https://www.excelbanter.com/excel-programming/286711-reference-using-excel-vbulletin-net.html)

Lee

Reference using Excel with VB.NET
 
I am having a heck of a time trying to learn how to
manipulate Excel from Visual Basic.NET. Does anyone know
of any good reference articles or books that address this
subject specifically? I found one article on MSDN
called "Understanding the Excel Object Model from a .NET
Developer's Perspective" which is good but I need more
details such as how to open and existing spreadsheet,
copy data from one range of cells on one worksheet to a
range of cells on another worksheet, etc. I am using
WindowsXP Home and Visual Studio.NET 2003.
Any help will be truely appreciated!
Regards,
Lee


Tom Ogilvy

Reference using Excel with VB.NET
 
I believe, once you get your reference to the excel application, you just
use the Excel object model to do the rest

oxlApp.Workbook.Open "C:\my Documents\Myfile.xls"
oxlApp.Activesheet.Range("A1:B20").Copy Destination:= _
oxlApp.ActiveSheet.parent.Worksheets("Sheet3").Ran ge("C32")

There is a lot of sample code in the Knowledge Base

You can look at this page as a start as well:

http://msdn.microsoft.com/office/understanding/vsto/
Visual Studio Tools for the Microsoft Office System

It is all about .Net and Office.

--
Regards,
Tom Ogilvy


Lee wrote in message
...
I am having a heck of a time trying to learn how to
manipulate Excel from Visual Basic.NET. Does anyone know
of any good reference articles or books that address this
subject specifically? I found one article on MSDN
called "Understanding the Excel Object Model from a .NET
Developer's Perspective" which is good but I need more
details such as how to open and existing spreadsheet,
copy data from one range of cells on one worksheet to a
range of cells on another worksheet, etc. I am using
WindowsXP Home and Visual Studio.NET 2003.
Any help will be truely appreciated!
Regards,
Lee




Lee

Reference using Excel with VB.NET
 
Thank you very much for the help and suggestions. They
were very helpful.
Regards,
Lee
-----Original Message-----
I believe, once you get your reference to the excel

application, you just
use the Excel object model to do the rest

oxlApp.Workbook.Open "C:\my Documents\Myfile.xls"
oxlApp.Activesheet.Range("A1:B20").Copy Destination:= _
oxlApp.ActiveSheet.parent.Worksheets("Sheet3").Ran ge

("C32")

There is a lot of sample code in the Knowledge Base

You can look at this page as a start as well:

http://msdn.microsoft.com/office/understanding/vsto/
Visual Studio Tools for the Microsoft Office System

It is all about .Net and Office.

--
Regards,
Tom Ogilvy


Lee wrote in message
...
I am having a heck of a time trying to learn how to
manipulate Excel from Visual Basic.NET. Does anyone

know
of any good reference articles or books that address

this
subject specifically? I found one article on MSDN
called "Understanding the Excel Object Model from

a .NET
Developer's Perspective" which is good but I need more
details such as how to open and existing spreadsheet,
copy data from one range of cells on one worksheet to a
range of cells on another worksheet, etc. I am using
WindowsXP Home and Visual Studio.NET 2003.
Any help will be truely appreciated!
Regards,
Lee



.



All times are GMT +1. The time now is 01:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com