cancel
Showing results for 
Search instead for 
Did you mean: 

Attaching excel instance by excel vbo with macro

PoojaVerma
Level 2
I have an issue where i am trying to run macro on the workbook opened by excel but it instead is creating a new excel instance to run the macro on that.

------------------------------
Pooja Verma
------------------------------
1 REPLY 1

PvD_SE
Level 12
Hi Pooja,

Trying to understand what's going on: So your XL is already opened and your process has attached to it (by creating an instance) and when you access it the process creates a new instance?

The usual way to use an existing XL in a process is:
  • create an instance (you'll get a handle back)
  • open the XL with the handle and path
  • work with the XL (get data, write data)
  • save (or save as) the XL 
  • close the XL
If you don't start by creating an instance, you do not have a handle and the process cannot open the XL.

------------------------------
Happy coding!
---------------
Paul
Sweden
------------------------------
Happy coding!
Paul, Sweden
(By all means, do not mark this as the best answer!)