Saving a FIle

mojo
09-02-2000, 08:05 AM
I am trying to copy a file (jobtracker.xls) and save it as temp.xls. However, if the file temp.xls already exists, the following message box is generated:

The File"temp.xls" already exists. Do you want to replace it?
YES NO CANCEL

I want it to copy over temp.xls if it already exists without the user having to answer "yes". Is there a way to do this automatically?

I am using the following code:

Dim XLJob As New Excel.Application
Dim XLtemp As New Excel.Application
XLJob.Workbooks.Open ("C:jobtrackerjobtracker.xls")
XLJob.ActiveWorkbook.SaveAs ("C:jobtracker emp.xls")
XLJob.Workbooks.Close
XLtemp.Workbooks.Open ("C:jobtracker emp.xls")
XLtemp.Application.Visible = True

Thanks for any help. Much appreciated....

makai
09-02-2000, 12:46 PM
before you do the copy

If Len(Dir(temp.xls)) Then Kill temp.xls

you might need the full path and name

makai
09-02-2000, 12:47 PM
I meant "temp.xls"

mojo
09-03-2000, 06:43 AM
Thanks makai

works perfectly...

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum