Win 10 + Excel 2010: send alt + alt + tab

Get help with using AutoHotkey and its commands and hotkeys
fux
Posts: 3
Joined: 17 Apr 2020, 20:32

Win 10 + Excel 2010: send alt + alt + tab

17 Apr 2020, 22:27

Hi all,

I am totally new to AutoHotkey and have a question regarding a script to get rid of the [Alt] + [Tab] behavior in Windows 10 and Excel 2010 when more than one workbook is open.

Normal behavior: [Alt] + [Tab] combination switches between the applications. This works even with Excel, when there is just one workbook open.
Behavior when more than one workbook is open in Excel 2010: [Alt] + [Tab] + [Tab] switches to the next/last application used.

So I was thinking of the following regarding this post: https superuser.com /questions/923380/why-cant-i-switch-between-workbooks-in-excel-2010-using-alt-tab Broken Link for safety

Unfortunately, it's not working the way I want to. Can somebody experienced help please?

Code: Select all

total = WinGetCount, Microsoft Excel

if (total >1){

	SetTitleMatchMode, 2
 	if WinActive, Microsoft Excel{
		LAlt & Tab::
		Send, {Alt Down}{Tab}{Tab}
		Return
	}
}
thanks!
Last edited by fux on 18 Apr 2020, 10:01, edited 2 times in total.
User avatar
Jovannb
Posts: 256
Joined: 17 Jun 2014, 02:44
Location: Austria

Re: Win 10 + Excel 2010

18 Apr 2020, 02:01

Hi

try that running example during you have some Excel-Workbooks open:

Code: Select all

#SingleInstance force

excel := ComObjActive("Excel.Application")
running_workbooks_count := excel.workbooks.count()

loop, %running_workbooks_count%
{
	excel.workbooks(a_index).activate
	current_workbook_name := excel.activeworkbook.Name
	excel.visible := true
	msgbox, Workbook-Name: %current_workbook_name% Workbook-Idx: %a_index%
}

return	
Tested with Win10 and Excel2010.

J.B.
AHK: 1.1.33.01 Ansi, 32-Bit; Win10 (2004, 19041.685) 64 bit, german
fux
Posts: 3
Joined: 17 Apr 2020, 20:32

Re: Win 10 + Excel 2010

18 Apr 2020, 09:56

Hi Jovannb,

thanks for your reply.

I am not sure how your script might help with my issue. When opened it tells me the workbook names and the script is quit then.

What I need is: if there is more than one workbook open and I use [Alt] + [Tab] to switch between open applications, AHK checks if there is more than one workbook open and sends [Alt] + [Tab] + [Tab].

Thanks

Return to “Ask For Help”

Who is online

Users browsing this forum: malcev, WatsonEnterprises, wineguy and 46 guests