M
Mark Tangard
I have a Word macro that launches Excel, grabs spreadsheet records, and
displays them (in a really big font) on a userform's listbox. In 2003
this works fine and Excel closes afterward as intended. In 2007 the same
code leaves Excel running, and this frightens the horses. Any
suggestions? The relevant code from the form is below. Thanks for any
clues. MT
Private Sub ShowML()
Dim XL As Object, XS As Worksheet, DBmaxRows As String, DBrangeAddr As
String
Set XL = GetObject("Z:\Test\MyNiceExcelFile.xls")
Set XS = XL.Sheets(1)
XL.Windows(1).Visible = False
DBmaxRows = XS.UsedRange.Rows.Count
DBrangeAddr = "A2:K" & DBmaxRows
LBX.List = XL.Sheets(1).Range(DBrangeAddr).value
LBX.BoundColumn = 0
XL.Close 0
Set XL = Nothing
Set XS = Nothing
DoEvents
LBX.ListIndex = 0
displays them (in a really big font) on a userform's listbox. In 2003
this works fine and Excel closes afterward as intended. In 2007 the same
code leaves Excel running, and this frightens the horses. Any
suggestions? The relevant code from the form is below. Thanks for any
clues. MT
Private Sub ShowML()
Dim XL As Object, XS As Worksheet, DBmaxRows As String, DBrangeAddr As
String
Set XL = GetObject("Z:\Test\MyNiceExcelFile.xls")
Set XS = XL.Sheets(1)
XL.Windows(1).Visible = False
DBmaxRows = XS.UsedRange.Rows.Count
DBrangeAddr = "A2:K" & DBmaxRows
LBX.List = XL.Sheets(1).Range(DBrangeAddr).value
LBX.BoundColumn = 0
XL.Close 0
Set XL = Nothing
Set XS = Nothing
DoEvents
LBX.ListIndex = 0