Kill statement error message?

D

Den

I am using the following sequence of code and I keep getting an error witht
the Kill statement. But I don't know why. The Filecopy statement works
fine but the Kill statement returns an error message saying an object is
required. What object, I have given it a valid file name and path. Any
suggestions?

ActiveWorkbook.SaveCopyAs (CurDir$ & "\" & myfname2)

On Error GoTo filenotcpy
Application.StatusBar = "Copying Temp file to Personnel"
FileCopy CurDir$ & "\" & myfname2, PersDir & myfname2
On Error GoTo cantdeletefile
Aplication.StatusBar = "Deleting Temp File"
Kill CurDir$ & "\" & myfname2
Application.StatusBar = ""
 
C

Chip Pearson

Den,

Are you sure it is the Kill statement that is causing the
problem? You misspelled 'Application' on the line above, which
will raise an 'object required' error (assuming you are not using
Option Explicit).


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
F

Frank Kabel

Hi
maybe removing the typo from
Aplication.StatusBar = "Deleting Temp File"

to
Application.StatusBar = "Deleting Temp File"

would do :)
 
D

Den

Dang, do I feel stupid. The problem was indeed the miss spelled
"Aplication".

Bad spelling gets me again.

thanks everyone.

Dennis
 
F

Frank Kabel

Hi
always include
Option explicit
at the beginning of your module. helps to prevent such typos
 
K

kkknie

A helpful hint is to type in lower case. Then if something does not ge
converted to uppercase automatically that normally does, you will kno
you've made an error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top