Deleting start button menu links from VBA

Posted on 2004-11-24
Last Modified: 2010-04-17
The VBA code (within an Access app) I use  to delete  start button menu items/links to an application that has become redundant:

'    by this point I have found out which OS we are talking about in strOS...

    Select Case strOS
    Case "98"
         ''' MsgBox "found win9X os, so delete shortcut from %windir%\start menu"
         Kill "C:\windows\start menu\programs\Counselog ADMIN"
         Kill "C:\windows\start menu\programs\Counselog DATA"
    Case "Mi"
         ''' MsgBox "found WinME os"
         Kill "C:\windows\start menu\programs\Counselog ADMIN"
         Kill "C:\windows\start menu\programs\Counselog DATA"

    Case "XP"
         ''' MsgBox "found Win2k / XP os"
         Kill "C:\documents and settings\" & currentUser & "\start menu\programs\Counselog DATA"
         Kill "C:\documents and settings\" & currentUser & "\start menu\programs\Counselog ADMIN"
    Case Else
         MsgBox "found no compatible OS"
    End Select


... unfortunately this results in 'file not found' at least in the Win ME case. The path as far as I can decide is correct...

Any ideas?

Many thanks.
Question by:Peborgh
    LVL 23

    Expert Comment

    Presuming that's the right path for ME and the files are there and deletable, I'd double check to make sure ME is being identified correctly.

    Author Comment

    It is. It's the frist thing I checked...

    What's this about being deletable. This is ME and it has no security anyone would recognise.

    Think on. Thanks.
    LVL 11

    Accepted Solution

    Peborgh.. you missed the .lnk extension at the end of the file :-)

             Kill "C:\windows\start menu\programs\Counselog ADMIN.lnk"
             Kill "C:\windows\start menu\programs\Counselog DATA.lnk"

    what cookre meant was to check if the file actually exists and not set to readonly

    Have Fun!

    Author Comment


    I have just discovered this .lnk business for myself!

    Tthanks anyway.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Suggested Solutions

    Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
    Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now