VBA statement "Kill" not recognized

    General discussion

  • Hi,
    I needed to write a VBA macro to be most compatible (would be used not only in MS Office), thus avoiding Scripting.FileSystemObject etc. Used Excel 2010 as a sandbox.

    Found out that VBA editor kind of doesn't recognize some legacy statements such as Kill pathname, Dir[(pathname[, attributes])] leaving them black. Some others such as Name oldpathname As newpathname get are correctly turned blue.

    Not big issue, but thanks for any comments/explanations.


    Friday, June 08, 2012 7:23 AM

All replies

  • It may not format Kill or Dir as keywords, but they should still work correctly. I use Dir all the time without any problems.

    Regards, Hans Vogelaar

    Friday, June 08, 2012 9:13 AM
  • Yes Hans, these DO work (I'd complain if they didn't). I was just curious if the formating ever worked for anyone else.

    Thanks and greetings from CZ to the Nederland.


    Friday, June 08, 2012 10:03 AM
  • The formatting doesn't work for me either.

    Greetings back to the Česká republika!

    Regards, Hans Vogelaar

    Friday, June 08, 2012 10:22 AM
  • Thanks. I just hope these legacy statements from times when programmes HAD some sense of black humor (Kill pathname) are not going to be deprecated


    Monday, June 11, 2012 11:23 AM
  • VBA does recognize the Kill statement. Look up "kill statement" in the VBA help and it comes up with a help topic. Additionally if I try kill( in a sub I get intellisense for it. Same thing with Dir.

    I tried this in Excel 2010 VBA. What Office program and version are you using to write this?

    Will Buffington
    Microsoft Excel Support

    Tuesday, June 12, 2012 10:46 PM
  • Hi,
    I meant VBA editor doesn't recognize kill = doesn't display it in blue color like other keywoards. Excel 2010


    Tuesday, June 12, 2012 11:20 PM