+ Reply to Thread
Results 1 to 8 of 8

'Kill'

  1. #1
    solomon_monkey
    Guest

    'Kill'

    Hi,

    I've read and re read many posts on this subject- I do not want to
    delete the file to the recycle bin just remove it completely so am
    using...

    Sub DeleteThisFile()

    Dim DeleteFile As String

    DeleteFile = ActiveWorkbook.FullName

    ActiveWorkbook.Close
    On Error Resume Next
    kill DeleteFile

    End Sub

    The user need not know that the fiule is being deleted... however when
    trying to run it I get the following 450 error

    'Wrong number of arguments or invalid property assignment'

    Am I missing something dreadfully obvious? It has been a long day...
    Thanks


  2. #2
    Harald Staff
    Guest

    Re: 'Kill'

    Is it asking for "save changes " ?
    Also, put
    DoEvents
    after the Close code to give it time to complete.

    HTH. Best wishes Harald

    "solomon_monkey" <[email protected]> skrev i melding
    news:[email protected]...
    > Hi,
    >
    > I've read and re read many posts on this subject- I do not want to
    > delete the file to the recycle bin just remove it completely so am
    > using...
    >
    > Sub DeleteThisFile()
    >
    > Dim DeleteFile As String
    >
    > DeleteFile = ActiveWorkbook.FullName
    >
    > ActiveWorkbook.Close
    > On Error Resume Next
    > kill DeleteFile
    >
    > End Sub
    >
    > The user need not know that the fiule is being deleted... however when
    > trying to run it I get the following 450 error
    >
    > 'Wrong number of arguments or invalid property assignment'
    >
    > Am I missing something dreadfully obvious? It has been a long day...
    > Thanks
    >




  3. #3
    solomon_monkey
    Guest

    Re: 'Kill'

    I will use this code as part of another sub so will incorporate save
    changes into that.

    Literally as I start to 'test' the macro, scrolling through using F8 it
    comes up with that error and highlights the word 'kill' suggesting I am
    not doing something I should...

    Hmmm.... just triued it on a non networked PC and it is all well and
    good... do networks make Macro;s behave as they should not? This may
    explain my other undecipherable problem on

    http://groups-beta.google.com/group/...69dc621880d180
    Thanks


  4. #4
    Don Guillett
    Guest

    Re: 'Kill'

    This was posted by Jim Rech:


    Sub testme()


    With ThisWorkbook
    .Saved = True
    .ChangeFileAccess xlReadOnly
    Kill .FullName
    .Close SaveChanges:=False
    End With


    End Sub



    --
    Don Guillett
    SalesAid Software
    [email protected]
    "solomon_monkey" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > I've read and re read many posts on this subject- I do not want to
    > delete the file to the recycle bin just remove it completely so am
    > using...
    >
    > Sub DeleteThisFile()
    >
    > Dim DeleteFile As String
    >
    > DeleteFile = ActiveWorkbook.FullName
    >
    > ActiveWorkbook.Close
    > On Error Resume Next
    > kill DeleteFile
    >
    > End Sub
    >
    > The user need not know that the fiule is being deleted... however when
    > trying to run it I get the following 450 error
    >
    > 'Wrong number of arguments or invalid property assignment'
    >
    > Am I missing something dreadfully obvious? It has been a long day...
    > Thanks
    >




  5. #5
    Harald Staff
    Guest

    Re: 'Kill'

    I see. Well, you may have Read and Modify priviledges in network folders,
    but still not be allowed to delete or replace files. This is a
    Windows/administrator problem if so. Code runs under the same restrictions
    as the user.

    HTH. Best wishes Harald

    "solomon_monkey" <[email protected]> skrev i melding
    news:[email protected]...

    > Hmmm.... just triued it on a non networked PC and it is all well and
    > good... do networks make Macro;s behave as they should not? This may
    > explain my other undecipherable problem on
    >
    >

    http://groups-beta.google.com/group/...69dc621880d180
    > Thanks
    >




  6. #6
    solomon_monkey
    Guest

    Re: 'Kill'

    I can delete files manually, but it is just not liking the Kill
    command. Many thanks.


  7. #7
    Harald Staff
    Guest

    Re: 'Kill'

    This is weird. Anything marked "Missing" in the Tools > References menu of
    the VB editor ? (This is where ghosts and werewolves tend to hide)

    Best wishes Harald

    "solomon_monkey" <[email protected]> skrev i melding
    news:[email protected]...
    > I can delete files manually, but it is just not liking the Kill
    > command. Many thanks.
    >




  8. #8
    solomon_monkey
    Guest

    Re: 'Kill'

    Visual Basic For Applications
    Microsoft Excel 11.0 Object Library
    OLE Automation
    Microsoft Office 11.0 Object Library

    Are the only 4 ticked... shed loads are not... nothing is marked
    'missing'.

    Regards,


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1