• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to Enable Maximise/ Minimise/ Close Button of Excel Worksheet ?

nagovind

Member
Hi


After opening a macro containing worksheet i lost my Maximise/ Minimise/ Close Button of Excel in my system. How to enable this using VBA


Also colour of the menu at the top is like shading at the end how to retrive the orginal colour.


Please assist me
 
wow.. this must be some hard core bad ass macro... I am not sure how to restore the buttons though. Try maximize / restore of excel window (not workbok). This should reset full screen mode if any...
 
Hi Chandoo


Actually Excel window has vanished only one "X" is displayed ..if i close it then current sheet get closed and NOT EXCEL


for closing the excel i used the close command from mouse right click from Windows task bar...
 
03 or 07?


Only reason I ask is I've experienced similar stuff in 03 that resolves itself if you open it up on another computer. It's not really a 'fix', but then again, in my experience this really isn't a bug.
 
Hi


I got the real Issue


Public Sub FullScreenView()

Application.DisplayFullScreen = True

End Sub


The above code doing some thing "virtually not showing" the said button after making the above code false it is ok now
 
SOLUTION


Private Declare Function FindWindowA Lib "USER32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare Function GetWindowLongA Lib "USER32" (ByVal hwnd As Long, ByVal nIndex As Long) As Long

Private Declare Function SetWindowLongA Lib "USER32" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long


Private Sub Workbook_Open()

Dim hwnd As Long

hwnd = FindWindowA(vbNullString, Application.Caption)

SetWindowLongA hwnd, -16, GetWindowLongA(hwnd, -16) And &HFFF7FFFF

End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Dim hwnd As Long

hwnd = FindWindowA(vbNullString, Application.Caption)

SetWindowLongA hwnd, -16, GetWindowLongA(hwnd, -16) Or &H80000

End Sub
 
Back
Top