Jump to content

Creating $oExcel object from already opened Excel Workbook


Recommended Posts

Hello,

How can I create an $oExcel Object from an already opened Excel-Workbook? Currently the ExcelCom_UDF seems to suppport the object creation only by creating a new workbook or opening one.

Background:

A few weeks ago, I programmed a Script which makes some Excel calculations. This Script seems to work pretty good.

Now I have a new requirement: The calculation should be generated right before saving the Excel-Sheet.

My currently planned solution:

Create a small "execute before Save" Makro in Excel which executes the script. This requires the possibility to work with the already opened Excel-Workbook.

Emergency-plan: :)

Completely rewrite the Script in VBA. Disadvantages: Additional time effort, VBA and me are not best friends. :)

Edited by madiator
Link to comment
Share on other sites

OK. First thinking then writing:

I tried to create an new Object via ObjCreate, since the Excel-Object have allready been created creating the Object via ObjGet has been more useful.

In the case that some others started breaking their heads: Thank you very much. :)

Link to comment
Share on other sites

How can I create an $oExcel Object from an already opened Excel-Workbook? Currently the ExcelCom_UDF seems to suppport the object creation only by creating a new workbook or opening one.

Not so:
#include <ExcelCOM_UDF.au3>
$oExcel = _ExcelAttach("C:\SpreadSheets\Test.xls", "FilePath")

:)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...