Excel Bug in Excel 2007? Activewindow

Joined
Jul 2, 2012
Messages
1
Reaction score
0
Hi
Anybody else having this problem?
In VBA using the Activewindow prevents Excel closing in Taskmanager.
When I rem out the Activewindow command, Excel shuts down properly.

Code:
Sub tester()
Dim objExcel As Excel.Application
Dim xlWB As Excel.Workbook
Set objExcel = New Excel.Application
Set xlWB = objExcel.Workbooks.Add
objExcel.Application.DisplayAlerts = False
xlWB.Sheets(1).Name = "MySheet"
'ActiveWindow.FreezePanes = True  'If this line is made active, Excel does not shut down
xlWB.SaveAs FileName:="C:\Users\elliotgr\Downloads\Temp\MyWorkbook.xlsx", _
FileFormat:=xlDefault, Password:="", WriteResPassword:="", _
        ReadOnlyRecommended:=False, CreateBackup:=False
xlWB.Close
Set xlWB = Nothing
objExcel.Application.DisplayAlerts = True
objExcel.Quit
Set objExcel = Nothing
End Sub

Using Windows 7 and Excel 2007
 
Back
Top