Run Macros from an excel to an especific spreadsheet HELP!!!
Posted: 16 Nov 2017, 14:55
Good Afternoon everyone, I'm kinda new using AutoHotKey and I was wondering, is there any way in which you create a script that can change the active sheet so the macros that was created on that Workbook works correctly?
btw the workbook is macros enabled.
I tried the following
!i::
xlFile := A_ScriptDir "\Templates.xlsm"
oExcel.Sheets("Ticket Creation Templates").Select
Macro := "Templates.xlsm!INCIDENT"
try xlApp := ComObjActive("Excel.Application")
catch
{
xlApp := ComObjCreate("Excel.Application")
xlApp.WorkBooks.Open(A_AppData "\Microsoft\Excel\XLSTART\PERSONAL.XLSB")
}
xlApp.Visible := true
xlApp.Run(Macro)
send, ^v
Return
However the macros created run in different layouts from the sheets.
please advise guys!!! I really appreaciate it
btw the workbook is macros enabled.
I tried the following
!i::
xlFile := A_ScriptDir "\Templates.xlsm"
oExcel.Sheets("Ticket Creation Templates").Select
Macro := "Templates.xlsm!INCIDENT"
try xlApp := ComObjActive("Excel.Application")
catch
{
xlApp := ComObjCreate("Excel.Application")
xlApp.WorkBooks.Open(A_AppData "\Microsoft\Excel\XLSTART\PERSONAL.XLSB")
}
xlApp.Visible := true
xlApp.Run(Macro)
send, ^v
Return
However the macros created run in different layouts from the sheets.
please advise guys!!! I really appreaciate it