#include-once
#include <File.au3>
#include <MsgBoxConstants.au3>
Global $filePath
$oExcel = ObjCreate("Excel.Application")
$oExcel.Visible = 0
WinActivate("Notepad")
Global $hWnd = WinWaitActive("Notepad", "", 5)
$filePath = _PathFull("Details.xlsm")
$oExcel.Application.WorkBooks.Open ($filePath)
Global $HomeStation1 = $oExcel.Application.Cells(7,2).Value
Global $AccountCode1 = $oExcel.Application.Cells(7,3).Value
Global $OAC1 = $oExcel.Application.Cells(7,4).Value
Global $Suffix1 = $oExcel.Application.Cells(7,5).Value
Global $AUTH1 = $oExcel.Application.Cells(7,6).Value
START ()
Func START ()
Send("{ESC}")
Sleep(700)
Send("I")
Sleep(700)
Send("{ENTER}")
Sleep(2000)
;I want to pick up data from Sheet 2, cell B2 and send it to notepad
Send("{ESC}")
Sleep(700)
Send("AAA"& $HomeStation1) ;This data comes from Sheet 1
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{ESC}")
Sleep(700)
$oExcel.Application.Quit
MsgBox(4096, "INFORMATION", "Processing Complete")
EndFunc
I am trying a script that picks data from an excel file and sends it to an open notepad file. I am not able to get my head around how to switch between 2 sheets within one Excel file. My Excel file 'Details.xlsm' has 2 sheets. I want to be able to read data from both the sheets without opening the file.
Your help with script is much appreciated