Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Hide Close Button Excel 2007

Hi,

I want to hide Minimize/Maximize/Close("X") buttons of an Excel
sheet(2007) which appears on title bar. To hide the buttons
programmatically, i write following code:

Please assume that my excel sheet is opened on desktop whose caption
is: "EXCELSHEET_TEST"

------------------------------------------------------------------------------------------------------------
HWND hwndExcelHandler = FindWindow(NULL, "EXCELSHEET_TEST");
DWORD dwStyle = GetWindowLong(hwndExcelHandler, GWL_STYLE);
::SetWindowLong(hwndExcelHandler, GWL_STYLE, (dwStyle &
~WS_MAXIMIZEBOX));

dwStyle = GetWindowLong(hwndExcelHandler, GWL_STYLE);
::SetWindowLong(hwndExcelHandler, GWL_STYLE, (dwStyle &
~WS_MINIMIZEBOX));

HMENU hMenuOfXLS = ::GetSystemMenu(hwndExcelHandler, false);
::DeleteMenu(hMenuOfXLS, SC_CLOSE, MF_BYCOMMAND); //ok actually
remove the close button
------------------------------------------------------------------------------------------------------------

This code successfully hides MINIMIZE and MAXIMIZE buttons, but it
doesn't hide CLOSE("X") button appears on title bar.

I tried testing it with Excel 2003 and it gives me expected results.
It hides all of three buttons MINIMIZE/MAXIMIZE/CLOSE of Excel 2003
titlebar.

Can anyone please suggest me why this code doesn't works for Excel
2007?

Any suggestion on the same would be appreciated.

Thank You,
Jaydeep

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
Close All in excel 2007 Anita Excel Discussion (Misc queries) 1 February 9th 07 09:22 PM
Excel close button unabled zapszipszops Excel Discussion (Misc queries) 2 April 19th 06 07:04 PM
How can you close a window with the back button in excel Holly Williams Excel Discussion (Misc queries) 0 September 20th 05 01:57 PM
Excel shoud not close all active books when clicking close button technomike Excel Discussion (Misc queries) 0 June 10th 05 05:35 PM
excel - Windows close button (x) should only close active workboo. CoffeeAdict Setting up and Configuration of Excel 3 February 8th 05 04:30 AM


All times are GMT +1. The time now is 05:01 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"