M
Mark Tangard
I have a userform that automates Excel from Word. That's not my strong
suit, but code that has worked fine in Office 2003 is messing up in
2007. The form just brings up a ListBox of data from the Excel sheet.
Relevant code is:
Dim XL As Excel.Application, XS As Excel.Worksheet
Set XL = GetObject("C:\Stuff\MyFile.xls")
XL.Windows(1).Visible = False
Set XS = XL.Sheets(1)
XL.Windows(1).Visible = False
<---code here fills a ListBox with some data from the Excel sheet
XL.Close 0
Set XL = Nothing
Set XS = Nothing
The code runs in both 2003 and 2007, but in 2007 it leaves an instance
of Excel running, which doesn't happen in 2003. How can I get Excel to
close? Grateful for any clues. WinXP SP3.
MT
suit, but code that has worked fine in Office 2003 is messing up in
2007. The form just brings up a ListBox of data from the Excel sheet.
Relevant code is:
Dim XL As Excel.Application, XS As Excel.Worksheet
Set XL = GetObject("C:\Stuff\MyFile.xls")
XL.Windows(1).Visible = False
Set XS = XL.Sheets(1)
XL.Windows(1).Visible = False
<---code here fills a ListBox with some data from the Excel sheet
XL.Close 0
Set XL = Nothing
Set XS = Nothing
The code runs in both 2003 and 2007, but in 2007 it leaves an instance
of Excel running, which doesn't happen in 2003. How can I get Excel to
close? Grateful for any clues. WinXP SP3.
MT