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

VS 2010 Controlling Excel From VB

$
0
0
I found http://www.vbforums.com/showthread.p...6-(or-VB5-VBA) very useful. But It did not cover one thing I need.

If I open a workbook and worksheet using this code:
HTML Code:

Dim oXLApp as Excel.Application        'Declare the object variables
Dim oXLBook as Excel.Workbook
Dim oXLSheet as Excel.Worksheet
 
 oXLApp = New Excel.Application    'Create a new instance of Excel
  oXLBook = oXLApp.Workbooks.Open("C:\Users\****\Desktop\Test.xls")
 oXLSheet = oXLBook.Worksheets(1)  'Work with the first worksheet

then I can edit it and do whatever I want with it. But if I already have an opened worksheet, lets say by another program, how can I edit it, without saving and closing and opening it again?
As far as I understand when user or another program opens excel it creates a connection, so is it possible to use that connection to work with already opened worksheet ? (this only my assumption, I don't know if it works this way).

I hope I made my question clear. Thanks

Viewing all articles
Browse latest Browse all 27329

Trending Articles



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