Hi ThriftyFinanceGirl
Are you *sure* this exact code has worked before?
It doesn't look right to me. Workbooks is a collection, not an object. It
should be either:
Set xlSheet = xlApp.Workbooks(1).Worksheets(1)
or
Set xlSheet = xlApp.ActiveWorkbook.Worksheets(1)
But since you already have an object xlBook, this would be better:
Set xlSheet = xlBook.Worksheets(1)
Also, I think that the incidences of xlApp.Application.Worksheets(1) further
down should instead just be xlSheet.
Finally, you should have xlApp.Quit before setting the object to Nothing.
Oh, and finally finally <g> you should declare the xlBlah variables "As
Object", not "As Variant".
--
Good Luck
Graham Mandeno [Access MVP]
Auckland, New Zealand
ThriftyFinanceGirl said:
Here is the actual code (stops on the Set xlSheet line)
=======================================
Dim xlApp As Variant
Dim xlBook As Variant
Dim xlSheet As Variant
On Error Resume Next
Set xlApp = CreateObject("Excel.Application")
Set xlBook =
xlApp.Workbooks.Open("\\Nas01\dol_exch\Departments\Accounting\Kyle
Enns\SalesTax\Sales Tax Update Tools\Sales Tax Utility Central.xls")
Set xlSheet = xlApp.Workbooks.Worksheets(1)
xlApp.Application.Visible = False
' Buttonline
xlApp.Application.Worksheets(1).CmdVarWO.Font.Bold = True
xlApp.Application.Worksheets(1).CmdVarWO.Activate
xlApp.Application.Worksheets(1).CmdVarWO.Refresh
xlApp.Application.Visible = False
xlBook.Close False
Set xlApp = Nothing
Set xlBook = Nothing
===========================================