ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Widening the Name Box -- need help (https://www.excelbanter.com/excel-programming/319498-widening-name-box-need-help.html)

John Wirt[_6_]

Widening the Name Box -- need help
 
I need to widen the Name Box in Excel 2000.

I was adviised on these pages to visit Chip Person's web page
(http://www.cpearson.com/excel/NameBox.htm). His technique for doing so is
to create a "regular" module in the PERSONAL.xls workbook and put the code
below in it."

Then the subroutine, WidenNameBoxDrop2, is called from a Workbook_Open
procedure inserted in the "This Workbook" module of PERSONAL.xls.

I've done all this and nothing happens when I open a new workbook. What's
wrong?

Even if I step through the WidenNameBoxDrop2 procedure, nothing happens.

John Wirt

- - - - - - - - - - - - - - -
PEARSON'S CODE:

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

Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long


Sub WidenNameBoxDrop2()
Dim Res As Long
Const CB_SETDROPPEDWIDTH = &H160
Const cWidth = 400 '<<<<<<<<<<<<<<<<<<<<<<
Res = SendMessage( _
FindWindowEx( _
FindWindowEx( _
FindWindow("XLMAIN", Application.Caption) _
, 0, "EXCEL;", vbNullString) _
, 0, "combobox", vbNullString), _
CB_SETDROPPEDWIDTH, cWidth, 0)
End Sub



Norman Jones

Widening the Name Box -- need help
 
Hi John,

The box (or, rather, the dropdown display) should widen when the dropdown
arrow is clicked. Is this not happening for you?


---
Regards,
Norman



"John Wirt" wrote in message
...
I need to widen the Name Box in Excel 2000.

I was adviised on these pages to visit Chip Person's web page
(http://www.cpearson.com/excel/NameBox.htm). His technique for doing so is
to create a "regular" module in the PERSONAL.xls workbook and put the code
below in it."

Then the subroutine, WidenNameBoxDrop2, is called from a Workbook_Open
procedure inserted in the "This Workbook" module of PERSONAL.xls.

I've done all this and nothing happens when I open a new workbook. What's
wrong?

Even if I step through the WidenNameBoxDrop2 procedure, nothing happens.

John Wirt

- - - - - - - - - - - - - - -
PEARSON'S CODE:

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

Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long


Sub WidenNameBoxDrop2()
Dim Res As Long
Const CB_SETDROPPEDWIDTH = &H160
Const cWidth = 400 '<<<<<<<<<<<<<<<<<<<<<<
Res = SendMessage( _
FindWindowEx( _
FindWindowEx( _
FindWindow("XLMAIN", Application.Caption) _
, 0, "EXCEL;", vbNullString) _
, 0, "combobox", vbNullString), _
CB_SETDROPPEDWIDTH, cWidth, 0)
End Sub





Bob Phillips[_6_]

Widening the Name Box -- need help
 
John,

It won't happen when you open a new workbook, but rather the next time you
start Excel (and open Personal.xls).

--

HTH

RP
(remove nothere from the email address if mailing direct)


"John Wirt" wrote in message
...
I need to widen the Name Box in Excel 2000.

I was adviised on these pages to visit Chip Person's web page
(http://www.cpearson.com/excel/NameBox.htm). His technique for doing so is
to create a "regular" module in the PERSONAL.xls workbook and put the code
below in it."

Then the subroutine, WidenNameBoxDrop2, is called from a Workbook_Open
procedure inserted in the "This Workbook" module of PERSONAL.xls.

I've done all this and nothing happens when I open a new workbook. What's
wrong?

Even if I step through the WidenNameBoxDrop2 procedure, nothing happens.

John Wirt

- - - - - - - - - - - - - - -
PEARSON'S CODE:

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

Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long


Sub WidenNameBoxDrop2()
Dim Res As Long
Const CB_SETDROPPEDWIDTH = &H160
Const cWidth = 400 '<<<<<<<<<<<<<<<<<<<<<<
Res = SendMessage( _
FindWindowEx( _
FindWindowEx( _
FindWindow("XLMAIN", Application.Caption) _
, 0, "EXCEL;", vbNullString) _
, 0, "combobox", vbNullString), _
CB_SETDROPPEDWIDTH, cWidth, 0)
End Sub





Gord Dibben

Widening the Name Box -- need help
 
John

An alternative to Chip's code...........

Robert Gelb has a free COM add-in that does this.

http://www.vbrad.com/pf.asp?p=Source...l_nb_addin.htm


Gord Dibben Excel MVP

On Wed, 22 Dec 2004 23:37:51 -0500, "John Wirt" wrote:

I need to widen the Name Box in Excel 2000.

I was adviised on these pages to visit Chip Person's web page
(http://www.cpearson.com/excel/NameBox.htm). His technique for doing so is
to create a "regular" module in the PERSONAL.xls workbook and put the code
below in it."

Then the subroutine, WidenNameBoxDrop2, is called from a Workbook_Open
procedure inserted in the "This Workbook" module of PERSONAL.xls.

I've done all this and nothing happens when I open a new workbook. What's
wrong?

Even if I step through the WidenNameBoxDrop2 procedure, nothing happens.

John Wirt

- - - - - - - - - - - - - - -
PEARSON'S CODE:

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

Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long


Sub WidenNameBoxDrop2()
Dim Res As Long
Const CB_SETDROPPEDWIDTH = &H160
Const cWidth = 400 '<<<<<<<<<<<<<<<<<<<<<<
Res = SendMessage( _
FindWindowEx( _
FindWindowEx( _
FindWindow("XLMAIN", Application.Caption) _
, 0, "EXCEL;", vbNullString) _
, 0, "combobox", vbNullString), _
CB_SETDROPPEDWIDTH, cWidth, 0)
End Sub




All times are GMT +1. The time now is 10:16 PM.

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