LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Excel 2003 and Application.Quit

I know there is a bug in Excel 2003 regarding smart
documents and applications.quit. However, I do not have
any smart documents, that I am aware of, and when the
application.quit is executed, excel stays open. Here is
my code.....

Sub Workbook_BeforeClose(Cancel As Boolean)

' Restore Toolbars And Return To Normal Screen
Application.DisplayFormulaBar = True
For i = 1 To Application.Toolbars.Count
Application.Toolbars(i).Visible = CurrentToolSet(i)
Next i

'Close Workbook and Do Not Save Changes Without Prompt
If LCase(Application.UserName) < "x" And LCase
(Application.UserName) < "y" Then
ThisWorkbook.Close SaveChanges:=False
End If


End Sub

Sub Workbook_Open()

' Emmulate Full Screen By Turning Off Active Toolbars
Application.WindowState = xlMaximized
Application.DisplayFormulaBar = False
For i = 1 To Application.Toolbars.Count
CurrentToolSet(i) = Application.Toolbars(i).Visible
Application.Toolbars(i).Visible = False
Next i

' Capture Today's Date For Auto Refresh Determination
Dim d_Today
Dim d_LstUpdt
d_Today = Date
d_LstUpdt = Worksheets("Parameters").Range("Q12").Value

' Set AutoCalc Off Due To Conflict With SAPBEX Query
Refresh Or Data Duplication
Application.Calculation = xlManual

' Detemine If Auto Refresh Should Be Executed
If (d_Today < d_LstUpdt) Then

If LCase(Application.UserName) = "x" Or LCase
(Application.UserName) = "y" Then

' Copy External Goals Data Into Corresponding
Worksheet
CopySheetValues "ChW Goal Sharing Goals
Data.xls", "Close", "Goals Qry", "Goals_Qry", "Goals
Data", 2

' Copy External Profit Centers & Cost Centers Data
Into Corresponding Worksheet
CopySheetValues "ChW Goal Sharing SAP BW
Data.xls", "", "Parameters", "Parameters", "Parameters", 0

' Copy External Finished Goods Output Data Into
Corresponding Worksheet
CopySheetValues "ChW Goal Sharing SAP BW
Data.xls", "", "FG Qry", "FG_Qry", "FG Data", 2

' Copy External Destructive Testing Data Into
Corresponding Worksheet
CopySheetValues "ChW Goal Sharing SAP BW
Data.xls", "", "IndMat Qry", "IndMat_Qry", "IndMat Data", 3

' Copy External Scrap/Inventory Adjustments Data Into
Corresponding Worksheet
CopySheetValues "ChW Goal Sharing SAP BW
Data.xls", "", "Scrap Qry", "Scrap_Qry", "Scrap Data", 3

' Copy External Inventory Adjustment Data Into
Corresponding Worksheet
CopySheetValues "ChW Goal Sharing SAP BW
Data.xls", "", "InvAdj Qry", "InvAdj_Qry", "InvAdj Data", 2

' Copy External Destructive Testing Data Into
Corresponding Worksheet
CopySheetValues "ChW Goal Sharing SAP BW
Data.xls", "Close", "DstTst Qry", "DstTst_Qry", "DstTst
Data", 4

' Copy External Equivalent Unit Output Data Into
Corresponding Worksheet
CopySheetValues "ChW Goal Sharing EU & FO
Data.xls", "Close", "EU FO Qry", "EU_FO_Qry", "EU FO
Data", 2

' Copy External Scrap Adjustment Data Into
Corresponding Worksheet
CopySheetValues "ChW Goal Sharing ScrAdj
Data.xls", "Close", "ScrAdj Qry", "ScrAdj_Qry", "ScrAdj
Data", 3

' Copy External Labor Data Into Corresponding
Worksheet
CopySheetValues "ChW Goal Sharing Labor
Data.xls", "Close", "Labor Qry", "Labor_Qry", "Labor
Data", 3

' Copy External Rework Data Into Corresponding
Worksheet
CopySheetValues "ChW Goal Sharing Rework
Data.xls", "Close", "Rework Qry", "Rework_Qry", "Rework
Data", 3

' Copy External QCS Zero Mileage Data Into
Corresponding Worksheet
CopySheetValues "ChW Goal Sharing QCS
Data.xls", "Close", "QCS0M Qry", "QCS0M_Qry", "QCS0M
Data", 4

' Filter Out Duplicate Profit Centers In Column A/B
and Copy Unique List to Column G/H
Worksheets("Parameters").Range("G13:H65000").Clear
Range("ProfitCenters").AdvancedFilter _
Action:=xlFilterCopy, CopyToRange:=Worksheets
("Parameters").Range("G13"), Unique:=True

' Filter Out Duplicate Cost Centers In Column C/D and
Copy Unique List to Column I/J
Worksheets("Parameters").Range("I13:J65000").Clear
Range("CostCenters").AdvancedFilter _
Action:=xlFilterCopy, CopyToRange:=Worksheets
("Parameters").Range("I13"), Unique:=True

' Capture Date For Last Updated
Worksheets("Parameters").Range("Q12").Value =
d_Today

' Reset AutoCalc On Due To Conflict With SAPBEX Query
Refresh Or Data Duplication
Application.Calculation = xlAutomatic

' Set Profit Center and Cost Center Drop Down Indices
To Plant Default
Worksheets("DropDowns").Range("B1").Value = 1
Worksheets("DropDowns").Range("H1").Value = 1

' Activate Status Worksheet
Worksheets("Status").Activate

' Exit Spreadsheet
ThisWorkbook.Close SaveChanges:=True
Application.Quit

End If
End If

' Set Profit Center and Cost Center Drop Down Indices To
Plant Default
Worksheets("DropDowns").Range("B1").Value = 1
Worksheets("DropDowns").Range("H1").Value = 1

' Activate Status Worksheet
Worksheets("Status").Activate

' Reset AutoCalc On Due To Conflict With SAPBEX Query
Refresh Or Data Duplication
Application.Calculation = xlAutomatic

End Sub

 
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
Excel application.quit in macro problem TimkenSteve New Users to Excel 3 August 17th 06 06:36 PM
macro to close excel application other than application.quit mary Excel Programming 1 September 14th 04 03:43 PM
Application.quit yuiriy Excel Programming 4 June 10th 04 08:36 AM
application.quit will not shut off application john Excel Programming 0 January 9th 04 11:29 PM
Macro to quit excel and go back to original application wendy Excel Programming 0 January 9th 04 08:22 PM


All times are GMT +1. The time now is 01:39 AM.

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"