Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 496
  • Last Modified:

Open specific Excel workbook tab with VBA & AHK commands

Note:  This question relates to both Excel VBA code and AutoHotKey (AHK) code.  However, I don't know if familiarity with the latter is necessary to provide a solution.

Hello,

I have got several VBA macros in Excel (2007) which are set up to activate various AHK commands.  

For example, this VBA code:
Sub Main_363_()
Shell ("c:\program files (x86)\autohotkey\autohotkey.exe
C:\Users\SEB\Documents\AHK_Excel\ExcelMacroScripts.ahk param363")
End Sub

Open in new window

launches this AHK command:
If 1 = param363	;Main_363_		
{
SetTitleMatchMode, 2
WinActivate, Main
}

Open in new window

which simply opens the specified Excel workbook.

How could either or both of these codes be modified so that instead of just opening the workbook to whichever worksheet happened to last be used, as is the case now, the code will open to a specific worksheet tab within the workbook ?

Thanks
0
Steve_Brady
Asked:
Steve_Brady
1 Solution
 
Rory ArchibaldCommented:
As a matter of interest, why do you need to invoke AHK if you are already using VBA? Why not just open the workbook in code and activate whatever sheet you want?
0
 
Steve_BradyAuthor Commented:
Thanks for the response.  I'm sorry for taking so long to get back to your question.

The answer is that I already have several AHK macros which run various commands involving both Excel and non-Excel applications.  Some triggers for these are hotkeys and others are GUI buttons but all were created using AHK.  Now I've got the need to write some macros which utilize non-Excel apps but also require access to specific Excel worksheet tabs rather than just workbooks.  Plus, I want the options of including the macro triggers as part of my existing set of hotkeys or as new GUI buttons.

Note:  because this question has expired, I am going to award points and open it anew.  Thanks again.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now