View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Worksheets that refuse to go away

I'd remove the "on error statement". Maybe the worksheet names aren't what you
expected?????



bails wrote:

Sorry for being vague with my problem, here's some of the code I'm
using

An Access file exports some queries to the given excel file and calls
one of its procedures

Code:
--------------------
... setup xlapp and file objects

DoCmd.TransferSpreadsheet transfertype:=acExport, tablename:="Query", Filename:="...file.xls"

...

file.Open "...file.xls"

'Run populateData Procedure of the excel file
xlApp.Run "populateData"


xlApp.Visible = True

Set file = Nothing
Set xlApp = Nothing
--------------------

the procedure populateDate contains:

Code:
--------------------
With ActiveWorkbook
On Error Resume Next
Application.DisplayAlerts = False
.Sheets("Qry_YearlyInvoiceSummary").Delete
.Sheets("Qry_YTDDiscardsGrouped").Delete
.Sheets("Qry_YTDInventoryCountsGrouped").Delete
Application.DisplayAlerts = True

End With
--------------------

I'm sure that i'm opening the same file all the time and sheet/file
names are spelled correctly

--
bails
------------------------------------------------------------------------
bails's Profile: http://www.excelforum.com/member.php...o&userid=36159
View this thread: http://www.excelforum.com/showthread...hreadid=559383


--

Dave Peterson