Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15,768
Default hide name box

Anyone know how to hide (not display) the name box *but still* display the
formula bar?

--
Biff
Microsoft Excel MVP



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default hide name box


Biff,
All the code I can remember seeing is aimed at widening the name box.
But that implies that it should be possible to make it smaller (zero?).
I tried the following code when the first version appeared,
maybe in 2000, but had, uhh, some stability problems...
http://www.vbrad.com/article.aspx?id=75
I believe also that Chip Pearson has some code on his site to widen the box.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


"T. Valko"
wrote in message
Anyone know how to hide (not display) the name box *but still* display the
formula bar?
--
Biff
Microsoft Excel MVP



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15,768
Default hide name box

Hi Jim!

You pretty much have the same thought process as I do.

I've seen requests to widen the box so you'd think that there should be a
way to set it to 0 width.

stability problems...


Yuck!

I'll try that add-in and also see what Chip has.

Thanks!

--
Biff
Microsoft Excel MVP


"Jim Cone" wrote in message
...

Biff,
All the code I can remember seeing is aimed at widening the name box.
But that implies that it should be possible to make it smaller (zero?).
I tried the following code when the first version appeared,
maybe in 2000, but had, uhh, some stability problems...
http://www.vbrad.com/article.aspx?id=75
I believe also that Chip Pearson has some code on his site to widen the
box.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


"T. Valko"
wrote in message
Anyone know how to hide (not display) the name box *but still* display the
formula bar?
--
Biff
Microsoft Excel MVP





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default hide name box

It's all 1 bar so all or nothing.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"T. Valko" wrote:

Anyone know how to hide (not display) the name box *but still* display the
formula bar?

--
Biff
Microsoft Excel MVP




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15,768
Default hide name box

I pretty much figured that but hoped there was some way to manipulate it
since it can be widened.

--
Biff
Microsoft Excel MVP


"John Bundy" (remove) wrote in message
...
It's all 1 bar so all or nothing.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"T. Valko" wrote:

Anyone know how to hide (not display) the name box *but still* display
the
formula bar?

--
Biff
Microsoft Excel MVP








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default hide name box

Anyone know how to hide (not display) the name box *but still* display
the formula bar?


How about if we leave it displayed, but clear the edit field and then
disable it? Add a Module and copy/paste all the code after my signature into
its code window. To use it, simply execute this code...

To disable Name Box: EnableNameComboBox False

To re-enable Name Box: EnableNameComboBox True

Note: I have cobbled this together from many different sources. I have left
in (or expanded on) the comments that were included with the original code
in case you want to "tinker" with the code some.

Rick

' Enables or disables a window. If a window is disabled, it cannot
' receive the focus and will ignore any attempted input. Some types
' of windows, such as buttons and other controls, will appear grayed
' when disabled, although any window can be enabled or disabled. The
' function returns 0 if the window had previously been enabled, or a
' non-zero value if the window had been disabled.
Private Declare Function EnableWindow Lib "user32.dll" _
(ByVal hwnd As Long, _
ByVal fEnable As Long) As Long

' Get the handle of the desktop window
Private Declare Function GetDesktopWindow Lib "user32" () As Long

' Get the process ID of this instance of Excel
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long

' Get the ID of the process that a window belongs to
Private Declare Function GetWindowThreadProcessId Lib "user32" _
(ByVal hwnd As Long, _
ByRef lpdwProcessId As Long) As Long

Private 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

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

Private Const WM_SETTEXT As Long = 12&

'Make the Name dropdown list 200 pixels wide
Public Sub EnableNameComboBox(State As Boolean)
Dim hWndFormulaBar As Long
Dim hWndNameCombo As Long
'Get the handle for the formula bar window
hWndFormulaBar = FindWindowEx(ApphWnd(), 0, "EXCEL;", vbNullString)
'Get the handle for the Name combobox
hWndNameCombo = FindWindowEx(hWndFormulaBar, 0, "combobox", vbNullString)
' Clear the NAME box's edit field
SendMessage hWndNameCombo, WM_SETTEXT, ByVal 0, ByVal ""
' Disable the NAME box
EnableWindow hWndNameCombo, State
End Sub

' Get the main Excel window's hWnd
Private Function ApphWnd() As Long
'Excel 2002 and above have a property for the hWnd
If Val(Application.Version) = 10 Then
ApphWnd = Application.hwnd
Else
ApphWnd = FindOurWindow("XLMAIN", Application.Caption)
End If
End Function

' Finds a top-level window of the given class and caption that
' belongs to this instance of Excel, by matching the process IDs
Private Function FindOurWindow(Optional sClass As String = vbNullString, _
Optional sCaption As String = vbNullString)
Dim hWndDesktop As Long
Dim hwnd As Long
Dim hProcThis As Long
Dim hProcWindow As Long
'Get the ID of this instance of Excel, to match to
hProcThis = GetCurrentProcessId
' All top-level windows are children of the desktop,
' so get that handle first
hWndDesktop = GetDesktopWindow
Do
' Find the next child window of the desktop that matches the given
' window class and/or caption. The first time in, hWnd will be zero,
' so we'll get the first matching window. Each call will pass the
' handle of the window we found the last time, thereby getting the
' next one (if any)
hwnd = FindWindowEx(hWndDesktop, hwnd, sClass, sCaption)
' Get the ID of the process that owns the window
GetWindowThreadProcessId hwnd, hProcWindow
' Loop until the window's process matches this process,
' or we didn't find a window
Loop Until hProcWindow = hProcThis Or hwnd = 0
' Return the handle we found
FindOurWindow = hwnd
End Function

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15,768
Default hide name box

Hi Rick!

Well, that's not what I had in mind but thanks for the time and effort.


--
Biff
Microsoft Excel MVP


"Rick Rothstein (MVP - VB)" wrote in
message ...
Anyone know how to hide (not display) the name box *but still* display
the formula bar?


How about if we leave it displayed, but clear the edit field and then
disable it? Add a Module and copy/paste all the code after my signature
into its code window. To use it, simply execute this code...

To disable Name Box: EnableNameComboBox False

To re-enable Name Box: EnableNameComboBox True

Note: I have cobbled this together from many different sources. I have
left in (or expanded on) the comments that were included with the original
code in case you want to "tinker" with the code some.

Rick

' Enables or disables a window. If a window is disabled, it cannot
' receive the focus and will ignore any attempted input. Some types
' of windows, such as buttons and other controls, will appear grayed
' when disabled, although any window can be enabled or disabled. The
' function returns 0 if the window had previously been enabled, or a
' non-zero value if the window had been disabled.
Private Declare Function EnableWindow Lib "user32.dll" _
(ByVal hwnd As Long, _
ByVal fEnable As Long) As Long

' Get the handle of the desktop window
Private Declare Function GetDesktopWindow Lib "user32" () As Long

' Get the process ID of this instance of Excel
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long

' Get the ID of the process that a window belongs to
Private Declare Function GetWindowThreadProcessId Lib "user32" _
(ByVal hwnd As Long, _
ByRef lpdwProcessId As Long) As Long

Private 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

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

Private Const WM_SETTEXT As Long = 12&

'Make the Name dropdown list 200 pixels wide
Public Sub EnableNameComboBox(State As Boolean)
Dim hWndFormulaBar As Long
Dim hWndNameCombo As Long
'Get the handle for the formula bar window
hWndFormulaBar = FindWindowEx(ApphWnd(), 0, "EXCEL;", vbNullString)
'Get the handle for the Name combobox
hWndNameCombo = FindWindowEx(hWndFormulaBar, 0, "combobox", vbNullString)
' Clear the NAME box's edit field
SendMessage hWndNameCombo, WM_SETTEXT, ByVal 0, ByVal ""
' Disable the NAME box
EnableWindow hWndNameCombo, State
End Sub

' Get the main Excel window's hWnd
Private Function ApphWnd() As Long
'Excel 2002 and above have a property for the hWnd
If Val(Application.Version) = 10 Then
ApphWnd = Application.hwnd
Else
ApphWnd = FindOurWindow("XLMAIN", Application.Caption)
End If
End Function

' Finds a top-level window of the given class and caption that
' belongs to this instance of Excel, by matching the process IDs
Private Function FindOurWindow(Optional sClass As String = vbNullString, _
Optional sCaption As String = vbNullString)
Dim hWndDesktop As Long
Dim hwnd As Long
Dim hProcThis As Long
Dim hProcWindow As Long
'Get the ID of this instance of Excel, to match to
hProcThis = GetCurrentProcessId
' All top-level windows are children of the desktop,
' so get that handle first
hWndDesktop = GetDesktopWindow
Do
' Find the next child window of the desktop that matches the given
' window class and/or caption. The first time in, hWnd will be zero,
' so we'll get the first matching window. Each call will pass the
' handle of the window we found the last time, thereby getting the
' next one (if any)
hwnd = FindWindowEx(hWndDesktop, hwnd, sClass, sCaption)
' Get the ID of the process that owns the window
GetWindowThreadProcessId hwnd, hProcWindow
' Loop until the window's process matches this process,
' or we didn't find a window
Loop Until hProcWindow = hProcThis Or hwnd = 0
' Return the handle we found
FindOurWindow = hwnd
End Function



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default hide name box

I realize this was not what you were looking for, but given your other
responses indicating that what you wanted was probably not possible, I
figured disabling the control was probably the closest you would be able to
come to what you asked for. As for the time and effort... well, I considered
the formulating of a plan of attack for your question, and then finding out
how to implement that plan, a fun thing to do. I'm sure, as a volunteer here
in these newsgroups, you get the same type of enjoyment in solving the
out-of-the-ordinary problems as I do.

Rick


"T. Valko" wrote in message
...
Hi Rick!

Well, that's not what I had in mind but thanks for the time and effort.


--
Biff
Microsoft Excel MVP


"Rick Rothstein (MVP - VB)" wrote in
message ...
Anyone know how to hide (not display) the name box *but still* display
the formula bar?


How about if we leave it displayed, but clear the edit field and then
disable it? Add a Module and copy/paste all the code after my signature
into its code window. To use it, simply execute this code...

To disable Name Box: EnableNameComboBox False

To re-enable Name Box: EnableNameComboBox True

Note: I have cobbled this together from many different sources. I have
left in (or expanded on) the comments that were included with the
original code in case you want to "tinker" with the code some.

Rick

' Enables or disables a window. If a window is disabled, it cannot
' receive the focus and will ignore any attempted input. Some types
' of windows, such as buttons and other controls, will appear grayed
' when disabled, although any window can be enabled or disabled. The
' function returns 0 if the window had previously been enabled, or a
' non-zero value if the window had been disabled.
Private Declare Function EnableWindow Lib "user32.dll" _
(ByVal hwnd As Long, _
ByVal fEnable As Long) As Long

' Get the handle of the desktop window
Private Declare Function GetDesktopWindow Lib "user32" () As Long

' Get the process ID of this instance of Excel
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long

' Get the ID of the process that a window belongs to
Private Declare Function GetWindowThreadProcessId Lib "user32" _
(ByVal hwnd As Long, _
ByRef lpdwProcessId As Long) As Long

Private 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

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

Private Const WM_SETTEXT As Long = 12&

'Make the Name dropdown list 200 pixels wide
Public Sub EnableNameComboBox(State As Boolean)
Dim hWndFormulaBar As Long
Dim hWndNameCombo As Long
'Get the handle for the formula bar window
hWndFormulaBar = FindWindowEx(ApphWnd(), 0, "EXCEL;", vbNullString)
'Get the handle for the Name combobox
hWndNameCombo = FindWindowEx(hWndFormulaBar, 0, "combobox",
vbNullString)
' Clear the NAME box's edit field
SendMessage hWndNameCombo, WM_SETTEXT, ByVal 0, ByVal ""
' Disable the NAME box
EnableWindow hWndNameCombo, State
End Sub

' Get the main Excel window's hWnd
Private Function ApphWnd() As Long
'Excel 2002 and above have a property for the hWnd
If Val(Application.Version) = 10 Then
ApphWnd = Application.hwnd
Else
ApphWnd = FindOurWindow("XLMAIN", Application.Caption)
End If
End Function

' Finds a top-level window of the given class and caption that
' belongs to this instance of Excel, by matching the process IDs
Private Function FindOurWindow(Optional sClass As String = vbNullString,
_
Optional sCaption As String = vbNullString)
Dim hWndDesktop As Long
Dim hwnd As Long
Dim hProcThis As Long
Dim hProcWindow As Long
'Get the ID of this instance of Excel, to match to
hProcThis = GetCurrentProcessId
' All top-level windows are children of the desktop,
' so get that handle first
hWndDesktop = GetDesktopWindow
Do
' Find the next child window of the desktop that matches the given
' window class and/or caption. The first time in, hWnd will be zero,
' so we'll get the first matching window. Each call will pass the
' handle of the window we found the last time, thereby getting the
' next one (if any)
hwnd = FindWindowEx(hWndDesktop, hwnd, sClass, sCaption)
' Get the ID of the process that owns the window
GetWindowThreadProcessId hwnd, hProcWindow
' Loop until the window's process matches this process,
' or we didn't find a window
Loop Until hProcWindow = hProcThis Or hwnd = 0
' Return the handle we found
FindOurWindow = hwnd
End Function




  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15,768
Default hide name box

I'm sure, as a volunteer here in these newsgroups, you get the same type of
enjoyment in solving the out-of-the-ordinary problems as I do.


Yes, absolutely!

--
Biff
Microsoft Excel MVP


"Rick Rothstein (MVP - VB)" wrote in
message ...
I realize this was not what you were looking for, but given your other
responses indicating that what you wanted was probably not possible, I
figured disabling the control was probably the closest you would be able to
come to what you asked for. As for the time and effort... well, I
considered the formulating of a plan of attack for your question, and then
finding out how to implement that plan, a fun thing to do. I'm sure, as a
volunteer here in these newsgroups, you get the same type of enjoyment in
solving the out-of-the-ordinary problems as I do.

Rick


"T. Valko" wrote in message
...
Hi Rick!

Well, that's not what I had in mind but thanks for the time and effort.


--
Biff
Microsoft Excel MVP


"Rick Rothstein (MVP - VB)" wrote
in message ...
Anyone know how to hide (not display) the name box *but still* display
the formula bar?

How about if we leave it displayed, but clear the edit field and then
disable it? Add a Module and copy/paste all the code after my signature
into its code window. To use it, simply execute this code...

To disable Name Box: EnableNameComboBox False

To re-enable Name Box: EnableNameComboBox True

Note: I have cobbled this together from many different sources. I have
left in (or expanded on) the comments that were included with the
original code in case you want to "tinker" with the code some.

Rick

' Enables or disables a window. If a window is disabled, it cannot
' receive the focus and will ignore any attempted input. Some types
' of windows, such as buttons and other controls, will appear grayed
' when disabled, although any window can be enabled or disabled. The
' function returns 0 if the window had previously been enabled, or a
' non-zero value if the window had been disabled.
Private Declare Function EnableWindow Lib "user32.dll" _
(ByVal hwnd As Long, _
ByVal fEnable As Long) As Long

' Get the handle of the desktop window
Private Declare Function GetDesktopWindow Lib "user32" () As Long

' Get the process ID of this instance of Excel
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long

' Get the ID of the process that a window belongs to
Private Declare Function GetWindowThreadProcessId Lib "user32" _
(ByVal hwnd As Long, _
ByRef lpdwProcessId As Long) As Long

Private 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

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

Private Const WM_SETTEXT As Long = 12&

'Make the Name dropdown list 200 pixels wide
Public Sub EnableNameComboBox(State As Boolean)
Dim hWndFormulaBar As Long
Dim hWndNameCombo As Long
'Get the handle for the formula bar window
hWndFormulaBar = FindWindowEx(ApphWnd(), 0, "EXCEL;", vbNullString)
'Get the handle for the Name combobox
hWndNameCombo = FindWindowEx(hWndFormulaBar, 0, "combobox",
vbNullString)
' Clear the NAME box's edit field
SendMessage hWndNameCombo, WM_SETTEXT, ByVal 0, ByVal ""
' Disable the NAME box
EnableWindow hWndNameCombo, State
End Sub

' Get the main Excel window's hWnd
Private Function ApphWnd() As Long
'Excel 2002 and above have a property for the hWnd
If Val(Application.Version) = 10 Then
ApphWnd = Application.hwnd
Else
ApphWnd = FindOurWindow("XLMAIN", Application.Caption)
End If
End Function

' Finds a top-level window of the given class and caption that
' belongs to this instance of Excel, by matching the process IDs
Private Function FindOurWindow(Optional sClass As String = vbNullString,
_
Optional sCaption As String =
vbNullString)
Dim hWndDesktop As Long
Dim hwnd As Long
Dim hProcThis As Long
Dim hProcWindow As Long
'Get the ID of this instance of Excel, to match to
hProcThis = GetCurrentProcessId
' All top-level windows are children of the desktop,
' so get that handle first
hWndDesktop = GetDesktopWindow
Do
' Find the next child window of the desktop that matches the given
' window class and/or caption. The first time in, hWnd will be zero,
' so we'll get the first matching window. Each call will pass the
' handle of the window we found the last time, thereby getting the
' next one (if any)
hwnd = FindWindowEx(hWndDesktop, hwnd, sClass, sCaption)
' Get the ID of the process that owns the window
GetWindowThreadProcessId hwnd, hProcWindow
' Loop until the window's process matches this process,
' or we didn't find a window
Loop Until hProcWindow = hProcThis Or hwnd = 0
' Return the handle we found
FindOurWindow = hwnd
End Function






  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default hide name box

I knew it!

So anyway, what is it you are trying to do that hiding the Name Box is the
only answer? Since a disabled Name Box is not an acceptable solution, would
a gap in its place on the formula bar be an acceptable one? I am just
curious as I have another idea I will try to pursue later on, but I don't
hold out much hope for it working.

Rick


"T. Valko" wrote in message
...
I'm sure, as a volunteer here in these newsgroups, you get the same type
of enjoyment in solving the out-of-the-ordinary problems as I do.


Yes, absolutely!

--
Biff
Microsoft Excel MVP


"Rick Rothstein (MVP - VB)" wrote in
message ...
I realize this was not what you were looking for, but given your other
responses indicating that what you wanted was probably not possible, I
figured disabling the control was probably the closest you would be able
to come to what you asked for. As for the time and effort... well, I
considered the formulating of a plan of attack for your question, and then
finding out how to implement that plan, a fun thing to do. I'm sure, as a
volunteer here in these newsgroups, you get the same type of enjoyment in
solving the out-of-the-ordinary problems as I do.

Rick


"T. Valko" wrote in message
...
Hi Rick!

Well, that's not what I had in mind but thanks for the time and effort.


--
Biff
Microsoft Excel MVP


"Rick Rothstein (MVP - VB)" wrote
in message ...
Anyone know how to hide (not display) the name box *but still* display
the formula bar?

How about if we leave it displayed, but clear the edit field and then
disable it? Add a Module and copy/paste all the code after my signature
into its code window. To use it, simply execute this code...

To disable Name Box: EnableNameComboBox False

To re-enable Name Box: EnableNameComboBox True

Note: I have cobbled this together from many different sources. I have
left in (or expanded on) the comments that were included with the
original code in case you want to "tinker" with the code some.

Rick

' Enables or disables a window. If a window is disabled, it cannot
' receive the focus and will ignore any attempted input. Some types
' of windows, such as buttons and other controls, will appear grayed
' when disabled, although any window can be enabled or disabled. The
' function returns 0 if the window had previously been enabled, or a
' non-zero value if the window had been disabled.
Private Declare Function EnableWindow Lib "user32.dll" _
(ByVal hwnd As Long, _
ByVal fEnable As Long) As Long

' Get the handle of the desktop window
Private Declare Function GetDesktopWindow Lib "user32" () As Long

' Get the process ID of this instance of Excel
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long

' Get the ID of the process that a window belongs to
Private Declare Function GetWindowThreadProcessId Lib "user32" _
(ByVal hwnd As Long, _
ByRef lpdwProcessId As Long) As Long

Private 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

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

Private Const WM_SETTEXT As Long = 12&

'Make the Name dropdown list 200 pixels wide
Public Sub EnableNameComboBox(State As Boolean)
Dim hWndFormulaBar As Long
Dim hWndNameCombo As Long
'Get the handle for the formula bar window
hWndFormulaBar = FindWindowEx(ApphWnd(), 0, "EXCEL;", vbNullString)
'Get the handle for the Name combobox
hWndNameCombo = FindWindowEx(hWndFormulaBar, 0, "combobox",
vbNullString)
' Clear the NAME box's edit field
SendMessage hWndNameCombo, WM_SETTEXT, ByVal 0, ByVal ""
' Disable the NAME box
EnableWindow hWndNameCombo, State
End Sub

' Get the main Excel window's hWnd
Private Function ApphWnd() As Long
'Excel 2002 and above have a property for the hWnd
If Val(Application.Version) = 10 Then
ApphWnd = Application.hwnd
Else
ApphWnd = FindOurWindow("XLMAIN", Application.Caption)
End If
End Function

' Finds a top-level window of the given class and caption that
' belongs to this instance of Excel, by matching the process IDs
Private Function FindOurWindow(Optional sClass As String =
vbNullString, _
Optional sCaption As String =
vbNullString)
Dim hWndDesktop As Long
Dim hwnd As Long
Dim hProcThis As Long
Dim hProcWindow As Long
'Get the ID of this instance of Excel, to match to
hProcThis = GetCurrentProcessId
' All top-level windows are children of the desktop,
' so get that handle first
hWndDesktop = GetDesktopWindow
Do
' Find the next child window of the desktop that matches the given
' window class and/or caption. The first time in, hWnd will be zero,
' so we'll get the first matching window. Each call will pass the
' handle of the window we found the last time, thereby getting the
' next one (if any)
hwnd = FindWindowEx(hWndDesktop, hwnd, sClass, sCaption)
' Get the ID of the process that owns the window
GetWindowThreadProcessId hwnd, hProcWindow
' Loop until the window's process matches this process,
' or we didn't find a window
Loop Until hProcWindow = hProcThis Or hwnd = 0
' Return the handle we found
FindOurWindow = hwnd
End Function









  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default hide name box

'Make the Name dropdown list 200 pixels wide
Public Sub EnableNameComboBox(State As Boolean)
........


By way of clarification, that comment block was left over from the routine I
used as a basis for the changes I made in order to create an enable/disable
routine for the Name Box... I should have changed it, but forgot to do so.

Rick

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you hide/un-hide the grid lines ED Excel Discussion (Misc queries) 4 February 26th 13 03:22 PM
Want to Hide columns in spreadsheet but NOT hide data in chart. KrispyData Charts and Charting in Excel 1 March 20th 09 04:45 PM
Specify which rows to NOT hide, and have excel hide the rest Mo2 Excel Programming 0 April 25th 07 03:44 AM
Hide And Un-hide Excel Toolbars Jim333[_4_] Excel Programming 3 July 2nd 05 08:00 PM
How do I hide a worksheet in Excel and use a password to un-hide . Dchung Excel Discussion (Misc queries) 3 December 2nd 04 06:24 AM


All times are GMT +1. The time now is 12:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"