Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with VBA code, making it spacific to one workbook


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
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
How to reference a spacific cell in multiple saved excel files. masa97 Excel Discussion (Misc queries) 0 March 4th 10 10:55 AM
How do I revert cells to blank automatically on spacific days? Conker10382 Excel Discussion (Misc queries) 5 May 25th 06 05:14 PM
Making A Code natei6 Excel Worksheet Functions 4 February 23rd 06 08:04 AM
how do i get a pop up with reminders of things to do at spacific . abc answering service Excel Discussion (Misc queries) 2 December 27th 05 05:31 PM
copying cells to another workbook if the contain spacific words prwells Excel Programming 0 October 23rd 03 10:37 PM


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