Control via COM an already open Excel Topic is solved

Get help with using AutoHotkey and its commands and hotkeys

Control via COM an already open Excel

22 Feb 2018, 11:46

Hello, i have this issue

Code: [Select all] [Download] GeSHi © Codebox Plus

oExcel := ComObjCreate("Excel.Application") 
oExcel.Visible := 1

With these lines of code i can open a new Excel instance and control it via the COM.
if an excel application is ALREADY open (with an active sheet), how could assign that istance to a COM object in order to control it via AHK?

Thank you for the replies
Posts: 964
Joined: 30 Sep 2013, 22:25

Re: Control via COM an already open Excel

22 Feb 2018, 23:36

You can also try just using the command made for it:
xlApp := ComObjActive("Excel.Application")

This will work for most people. It is all I ever use and I use COM with Excel alot on several different computers.

The Excel_Get function is more robust and can handle some fringe cases.

Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

Google Search, Dictionary, Thesaurus - Quickly Get Information from Specific Web Resources

[Function] Timer - Create and Manage Timers

Re: Control via COM an already open Excel

23 Feb 2018, 03:47

Thank you very much.

ComObjActive for now is enough for me, if i will detect further problems i will pass to Excel_Get()


Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], ThiefUK and 46 guests