Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Returns currently selected cell (or range of cells) from Excel 2007
- ;you can place this script in Your Lib https://autohotkey.com/docs/Functions.htm#lib
- /*
- In Excel perform the following steps:
- -------------------------------------
- ctrl+F3 [Name Manager] Window
- alt+n [&New...] Button -> opens "New Name" Window
- alt+r [&Refers to:] Edit box (text will be selected)
- Ctrl+C [system copy] (or get this text any other way)
- Esc [close alt+n]
- Esc [close ctrl+f3]
- the retrieved text will contain something like this when standing in a single cell before executing these steps:
- =NameOfWorksheet!$G$3
- where cell is G3
- -------------------------------------------
- -------------------------------------------
- Name Manager
- ahk_class bosa_sdm_XL9
- >>>>>>>>( Window Title & Class )<<<<<<<<<<<
- New Name
- ahk_class bosa_sdm_XL9
- >>>>>>>>>( Now Under Mouse Cursor )<<<<<<<<
- ClassNN: EDTBX3
- Text:
- >>>>( TitleMatchMode=slow Visible Text )<<<<
- =NameOfWorksheet!$G$3
- */
- ExcelGetCell(auto:=1, WinTitle:="New Name ahk_class bosa_sdm_XL9", Control:="EDTBX3")
- {
- if auto
- {
- IfWinActive,Microsoft Excel ahk_class XLMAIN
- {
- Send ^{F3}
- Sleep 100
- Send !n
- Sleep 100
- } else
- return false
- }
- IfWinExist,%WinTitle%
- {
- ControlGetText, OutputVar, %Control%, %WinTitle%
- if ErrorLevel
- return false
- if StrLen(OutputVar)<2
- return false
- } else
- return false
- if auto
- {
- Send {Esc}
- Sleep 100
- Send {Esc}
- }
- return OutputVar
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement