Deleting start button menu links from VBA

Posted on 2004-11-24
Medium Priority
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
  • 2
LVL 22

Expert Comment

ID: 12668451
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

ID: 12668528
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

pratap_r earned 750 total points
ID: 12676154
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

ID: 12676181

I have just discovered this .lnk business for myself!

Tthanks anyway.

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Loops Section Overview

840 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