Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disable Min Max restore buttons
How do I Hide / disable Min/Max/Close buttons in XLapp and XlWorkbook windows
If cant be done then how can i direct code towards a button on a form which sits over the spreadsheet and perform the button click event of that for I am automating excel for VB.net Cheer pete |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disable Min Max restore buttons
Hi Pete,
Perhaps like that: Set xlApp = WScript.CreateObject("Excel.Application") Set xlWbk = xlApp.Workbooks.Add xlApp.ActiveWorkbook.VBProject.VBComponents.Add(1) .Name = "TmpModul" AddCodeLine "TmpModul", "Private Declare Function FindWindowA Lib ""User32"" (ByVal lpClassName$, ByVal lpWindowName$) As Long" AddCodeLine "TmpModul", "Private Declare Function SetWindowLongA Lib ""User32"" (ByVal hWnd&, ByVal nIndex&, ByVal dwNewLong&) As Long" AddCodeLine "TmpModul", "Private Declare Function DrawMenuBar Lib ""User32"" (ByVal hWnd&) As Long" AddCodeLine "TmpModul", "" AddCodeLine "TmpModul", "Sub LockExcel()" AddCodeLine "TmpModul", "ActiveWindow.WindowState = xlMaximized" AddCodeLine "TmpModul", "ThisWorkbook.Unprotect" AddCodeLine "TmpModul", "ActiveWindow.WindowState = xlMaximized" AddCodeLine "TmpModul", "Dim hWnd As Long" AddCodeLine "TmpModul", "hWnd = FindWindowA(vbNullString, Application.Caption)" AddCodeLine "TmpModul", "SetWindowLongA hWnd, -16, &H15470000" AddCodeLine "TmpModul", "DrawMenuBar hWnd" AddCodeLine "TmpModul", "ThisWorkbook.Protect Structu=False, Windows:=True" AddCodeLine "TmpModul", "End sub" xlApp.Visible = True xlApp.Run xlWbk.Name & "!LockExcel" With xlApp.ActiveWorkbook.VBProject.VBComponents .Remove .Item("TmpModul") End With ' ... Set xlWbk = Nothing Set xlApp = Nothing Sub AddCodeLine(strComponentName, strCodeLine) With xlApp.ActiveWorkbook.VBProject.VBComponents(strCom ponentName).CodeModule .InsertLines .CountOfLines + 1, strCodeLine End With End Sub MP "PeteSmith" a écrit dans le message de ... How do I Hide / disable Min/Max/Close buttons in XLapp and XlWorkbook windows. If cant be done then how can i direct code towards a button on a form which sits over the spreadsheet and perform the button click event of that form I am automating excel for VB.net Cheers pete |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Buttons for Minimize, Restore and Close missing from Workbook | Excel Discussion (Misc queries) | |||
Disable Cut & Copy then restore on exiting | Excel Discussion (Misc queries) | |||
Restore superscript and subscript buttons in Excel toolbars | Excel Discussion (Misc queries) | |||
excel 'lost my title bar with min. restore down, close buttons' | Excel Discussion (Misc queries) | |||
Disabling Minimise/Restore Down buttons | Excel Programming |