Using two Excel Book Handles at once

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
winstein
Pro Scripter
Posts: 84
Joined: Mon Nov 26, 2012 3:44 pm

Using two Excel Book Handles at once

Post by winstein » Mon Sep 25, 2017 10:42 am

I am currently using two Excel workbook at once, but I ran into a problem: after I opened a second workbook, whenever I want to retrieve or write data on the first workbook, I got the error that the "Call was rejected by callee". Even if I closed the second workbook, I still cannot read/write data on the first workbook.

To clarify on what I want to do with two open workbooks, I want to add a new row for a lookup sheet whenever the data currently doesn't exist in the current lookup sheet.

Perhaps I could provide a simple code for troubleshooting (the second and third XLGetCell will have that error):

Code: Select all

XLOpen>%file_Lookup%,0,xlFileLookup
XLGetCell>xlFileLookup,Data,1,1,Res
XLOpen>%file_EmpMaster%,0,xlEmpMaster
XLGetCell>xlFileLookup,Data,1,1,Res
XLQuit>xlEmpMaster
XLGetCell>xlFileLookup,Data,1,1,Res
XLQuit>xlFileLookup
How do I write around this problem?

Thank you for reading.
PPQ

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Using two Excel Book Handles at once

Post by Marcus Tettmar » Tue Sep 26, 2017 9:07 am

I am unable to replicate an error. The same code (but obviously two different workbooks that I have created here) works fine. I'm able to XLOpen multiple workbooks and retrieve data from all, moving from one to the other.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

winstein
Pro Scripter
Posts: 84
Joined: Mon Nov 26, 2012 3:44 pm

Re: Using two Excel Book Handles at once

Post by winstein » Tue Sep 26, 2017 10:04 am

Never mind, I found out the problem just now: it's the fact that the Excel is considered "unactivated", which means that when I open Excel, there would be a pop up stating to activate it.
PPQ

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts