I use the following script to remove the userform caption, however, sometimes it decides to remove the workbook caption instead, can someone please provide a script that I can use to redraw/ show the workbook caption.
I have tried application.caption="" but nothing happens
Code:
'Option Private Module
'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 RemoveCaption1()
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