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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top