I am hoping that there would be a way to get the content of the 'Name Box' in an Excel spreadsheet.
I know that this statement works (thanks to a script from Support):
DDERequest>Excel,c:\docs\book1.xls,R1C1,60
MessageModal>The content of R1C1 is: %result%
But I was hoping this statement:
DDERequest>Excel,c:\docs\book1.xls,"Name Box",result,60
MessageModal>The content of Name Box is: %result%
Or:
DDERequest>Excel,c:\docs\book1.xls,Name Box,result,60
MessageModal>The content of Name Box is: %result%
But they don't. MsSchd would just hang.
My intent was for operator to click on a cell, the subsequent statement would POKE a value in it.
I hope that I would receive help here.
Thanks.
Excel and DDE
Moderators: Dorian (MJT support), JRL
Excel and DDE
If you could set focus on the Name Box, you could set a Macro Scheduler variable to equal the contents of the Name Box somehow by using the clipboard.
Perhaps you or others will find a clue to setting focus on the Name Box in the following excerpt from the Web:
". . . following macro . . . set[s] the focus to the defined name box."
Public Declare Function SetFocus Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, _
ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Sub SetFocusNameBox()
Dim Res As Long
Res = SetFocus( _
FindWindowEx( _
FindWindowEx( _
FindWindow("XLMAIN", Application.Caption) _
, 0, "EXCEL;", vbNullString) _
, 0, "combobox", vbNullString))
End Sub
Perhaps you or others will find a clue to setting focus on the Name Box in the following excerpt from the Web:
". . . following macro . . . set[s] the focus to the defined name box."
Public Declare Function SetFocus Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, _
ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Sub SetFocusNameBox()
Dim Res As Long
Res = SetFocus( _
FindWindowEx( _
FindWindowEx( _
FindWindow("XLMAIN", Application.Caption) _
, 0, "EXCEL;", vbNullString) _
, 0, "combobox", vbNullString))
End Sub
Excel and DDE
Actually, there's a much, much easier way. If your spreadsheet file's name is Book1:
GetControlText>Microsoft Excel - Book1,ComboBox,1,Result
The variable Result will be set to equal the contents of the Name Box.
GetControlText>Microsoft Excel - Book1,ComboBox,1,Result
The variable Result will be set to equal the contents of the Name Box.