Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I have this code....I would like for it to me changed so that it only effects that one workbook and not any of the ones that are open or would be open while this is open. TY Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As Long, ByVal bRevert As Long) As Long Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long Private Declare Function FindWindowA Lib "user32" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function SetWindowLong Lib "user32" Alias _ "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, _ ByVal dwNewLong As Long) As Long Private Declare Function GetWindowLong Lib "user32" Alias _ "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) _ As Long Const WS_MINIMIZEBOX = &H20000 Const WS_MAXIMIZEBOX = &H10000 Const GWL_STYLE = (-16) Sub auto_close() Dim MyHandle Dim hWnd As Long MyCap$ = Application.Caption hWnd = FindWindowA(vbNullString, MyCap$) MyHandle = GetSystemMenu(hWnd, 1) Call RemoveMenu(MyHandle, 6, &H400) Application.DisplayFormulaBar = True Application.ScreenUpdating = False Application.DisplayCommentIndicator = xlNoIndicator Application.CommandBars("Standard").Visible = True Application.CommandBars("Formatting").Visible = True Application.CommandBars("Drawing").Visible = True Application.CellDragAndDrop = True Application.CommandBars("Worksheet Menu Bar").Enabled = True With ActiveWindow ..DisplayHeadings = True ..DisplayHorizontalScrollBar = True ..DisplayVerticalScrollBar = True ..DisplayWorkbookTabs = True End With Application.WindowState = xlMaximized Dim L As Long L = GetWindowLong(Application.hWnd, GWL_STYLE) L = SetWindowLong(Application.hWnd, GWL_STYLE, WS_MINIMIZEBOX _ Or WS_MAXIMIZEBOX Or L) ThisWorkbook.Saved = True ThisWorkbook.Close True End Sub Sub Print_1() Application.ScreenUpdating = False ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True End Sub -- polska2180 ------------------------------------------------------------------------ polska2180's Profile: http://www.excelforum.com/member.php...o&userid=27599 View this thread: http://www.excelforum.com/showthread...hreadid=471158 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to reference a spacific cell in multiple saved excel files. | Excel Discussion (Misc queries) | |||
How do I revert cells to blank automatically on spacific days? | Excel Discussion (Misc queries) | |||
Making A Code | Excel Worksheet Functions | |||
how do i get a pop up with reminders of things to do at spacific . | Excel Discussion (Misc queries) | |||
copying cells to another workbook if the contain spacific words | Excel Programming |