Show Workbook/ Window Caption

Jaye7

Well-known Member
Joined
Jul 7, 2010
Messages
1,060
I have the following script to remove captions, can someone please help with a script to show captions.

I have tried the following codes by themseleves and together but nothing happens.

Code:
Application.CommandBars("Worksheet Menu Bar").Enabled = True
 
Application.CommandBars("Worksheet Menu Bar").Visible = True
 
Application.CommandBars("Worksheet Menu Bar").Reset
 
Application.Caption = ""
 
Application.Caption = "List"

code to remove captions follows

Code:
'Returns the Window Handle of the Window
'that is accepting User input.
 Public Declare Function GetForegroundWindow _
   Lib "User32.dll" () As Long
 Private Declare Function GetWindowLong _
  Lib "User32.dll" _
    Alias "GetWindowLongA" _
     (ByVal hWnd As Long, _
      ByVal nIndex As Long) As Long
 
 Private Declare Function SetWindowLong _
  Lib "User32.dll" _
    Alias "SetWindowLongA" _
     (ByVal hWnd As Long, _
      ByVal nIndex As Long, _
      ByVal dwNewLong As Long) As Long
'Redraw the Icons on the Window's Title Bar
 Private Declare Function DrawMenuBar _
   Lib "User32.dll" _
    (ByVal hWnd As Long) As Long
 Private Const GWL_STYLE As Long = (-16)
 Private Const WS_CAPTION = &HC00000
Sub RemoveCaption()
  Dim BitMask As Long
  Dim hWnd As Long
  Dim WindowStyle As Long
 
    hWnd = GetForegroundWindow
    WindowStyle = GetWindowLong(hWnd, GWL_STYLE)
    BitMask = WindowStyle And (Not WS_CAPTION)
    Call SetWindowLong(hWnd, GWL_STYLE, BitMask)
    Call DrawMenuBar(hWnd)
 
End Sub
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Forum statistics

Threads
1,215,534
Messages
6,125,374
Members
449,221
Latest member
chriscavsib

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top