ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Defined Name Box Shortcut (https://www.excelbanter.com/excel-programming/347884-defined-name-box-shortcut.html)

[email protected]

Defined Name Box Shortcut
 
I got this from Chip Pearsonīs site, but donīt works for me (Win XP,
Excel 2003 portuguese).

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

Then I tried this and worked:

Sub DefinedNames()
Application.Dialogs(xlDialogDefineName).Show , "=" & ActiveSheet.Name &
"!" & ActiveCell.Address
End Sub

What am I missing?

Thanks
Hamilton R. Romano


Chip Pearson

Defined Name Box Shortcut
 
Did you assign a shortcut key to the SetFocusNameBox macro?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


wrote in message
ups.com...
I got this from Chip Pearsonīs site, but donīt works for me (Win
XP,
Excel 2003 portuguese).

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

Then I tried this and worked:

Sub DefinedNames()
Application.Dialogs(xlDialogDefineName).Show , "=" &
ActiveSheet.Name &
"!" & ActiveCell.Address
End Sub

What am I missing?

Thanks
Hamilton R. Romano



Bob Phillips[_6_]

Defined Name Box Shortcut
 
You could also try Ctrl-F3

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

wrote in message
ups.com...
I got this from Chip Pearsonīs site, but donīt works for me (Win XP,
Excel 2003 portuguese).

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

Then I tried this and worked:

Sub DefinedNames()
Application.Dialogs(xlDialogDefineName).Show , "=" & ActiveSheet.Name &
"!" & ActiveCell.Address
End Sub

What am I missing?

Thanks
Hamilton R. Romano



keepITcool

Defined Name Box Shortcut
 


Chip's code assumes the "Formula Bar" is visible
THEN put's the focus on the name combobox
(located at the left side of the formula bar.)

The DefineName dialog is something else...


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


wrote :

I got this from Chip Pearsonīs site, but donīt works for me (Win XP,
Excel 2003 portuguese).

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

Then I tried this and worked:

Sub DefinedNames()
Application.Dialogs(xlDialogDefineName).Show , "=" & ActiveSheet.Name
& "!" & ActiveCell.Address
End Sub

What am I missing?

Thanks
Hamilton R. Romano


[email protected]

Defined Name Box Shortcut
 
Thank you guys.

Hamilton R. Romano

keepITcool escreveu:

Chip's code assumes the "Formula Bar" is visible
THEN put's the focus on the name combobox
(located at the left side of the formula bar.)

The DefineName dialog is something else...


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


wrote :

I got this from Chip Pearsonīs site, but donīt works for me (Win XP,
Excel 2003 portuguese).

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

Then I tried this and worked:

Sub DefinedNames()
Application.Dialogs(xlDialogDefineName).Show , "=" & ActiveSheet.Name
& "!" & ActiveCell.Address
End Sub

What am I missing?

Thanks
Hamilton R. Romano




All times are GMT +1. The time now is 01:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com