I lose COM connection saving and loading the script.

Advanced Macro Recorder/Editor.

Moderator: Pulover

Sscratchie
Posts: 5
Joined: 11 Oct 2021, 20:16

I lose COM connection saving and loading the script.

13 Nov 2021, 10:03

Latest PMC, Excel 14 32 bit, Win 10.

This breaks when I load the macro. Clicking the Connect button in the COM interface fixes it. I've tried different COM commands and they all fail.

Code: Select all

WinActivate, Microsoft Excel - Book1.xlsm
Sleep, 333
If (!IsObject(XL))
    XL := ComObjCreate("Excel.Application")
XL.Range("D1").Select
I thought AHK was awesome before I worked out COM. I understand why 0.1% people use Office now. Can't figure out why the rest of them do.
User avatar
Pulover
Posts: 612
Joined: 29 Sep 2013, 19:51
Location: Brazil
Contact:

Re: I lose COM connection saving and loading the script.

13 Nov 2021, 13:45

You must change the command to ComObjActive() to connect to the last active window. This can be changed in export options.
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
Sscratchie
Posts: 5
Joined: 11 Oct 2021, 20:16

Re: I lose COM connection saving and loading the script.

13 Nov 2021, 21:47

Thanks. Solved

Code: Select all

If (!IsObject(XL))
    XL := ComObjCreate("Excel.Application")
XL := ComObjActive("Excel.Application")
It's the first time I've worked with a currency with 12 decimal places.
Monero Wallet to Quickbooks via dos shell, Bash shell, Excel, VB and AHK tying it together
Peter_g
Posts: 6
Joined: 04 Dec 2021, 10:52

Re: I lose COM connection saving and loading the script.

14 Dec 2021, 05:36

Excuse me, may I ask you, what do 99.9% of people use instead of Office?
Sscratchie
Posts: 5
Joined: 11 Oct 2021, 20:16

Re: I lose COM connection saving and loading the script.

16 Dec 2021, 20:57

I've never seen an incoming email to Outlook create a new account in an accounting package or add/change fields in an Excel spreadsheet.
Everybody uses Office but doesn't use the extended functionality provided by VB and COM.
I've never seen AHK anywhere but where I used to work and no-one there knew it was AHK making the F keys do stuff.

Return to “Pulovers Macro Creator”

Who is online

Users browsing this forum: No registered users and 20 guests