Excel - XLBookhandle Using ExecuteFile> Command

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Franklin
Newbie
Posts: 16
Joined: Mon Dec 14, 2015 5:14 pm

Excel - XLBookhandle Using ExecuteFile> Command

Post by Franklin » Tue Jul 21, 2020 7:09 pm

Using XLCreate/XLOpen is actioned via COM so macros within personal & Xlam files not available unless included with existing workbook.

Excel Macros and AddIns can be accessed if the file is opened with ExecuteFile>workbook.xlsx

XLBookHandle is a handle returned when using XLCreate/XLOpen but isn't available when using ExecuteFile>

Questions:
What information does the handle return? looks like it's 1= visible or 0=invisible
Can a variable be created to match the handle information so XL commands can be used?

I tried the code below without success.


Example Code:

Code: Select all

ExecuteFile>myexcelworkbook.xlsx
WindowAction>1, myexcelworkbook*
SetFocus>Myexcelworkbook*
Let>xlbook=1

XlDelRow>xlbook,Sheet1, 1
XlDelCol>xlbook, A:A

Is there an alternative method to get the Excel Addins& Global Macros to work when using Execute File method?
Last edited by Franklin on Tue Jul 21, 2020 7:59 pm, edited 2 times in total.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Excel - XLBookhandle Using ExecuteFile> Command

Post by Dorian (MJT support) » Tue Jul 21, 2020 7:20 pm

Use XLGet to attach to an existing running instance of Excel. This assigns it the handle you need to use the other XL commands.
Yes, we have a Custom Scripting Service. Message me or go here

Franklin
Newbie
Posts: 16
Joined: Mon Dec 14, 2015 5:14 pm

Re: Excel - XLBookhandle Using ExecuteFile> Command

Post by Franklin » Tue Jul 21, 2020 8:00 pm

I am definitely going to reread the MacroScheduler Manual.

Again thank you for your support!

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Excel - XLBookhandle Using ExecuteFile> Command

Post by Dorian (MJT support) » Tue Jul 21, 2020 8:35 pm

It's certainly worth going through the command reference one section at a time. That's how I learned it all in the first place. It's grown a lot since then. Plenty of surprises in there!
Yes, we have a Custom Scripting Service. Message me or go here

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