954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Unable to delete a shortcut file using this code , but i am able to delete other file

Set fso = New FileSystemObject
      If fso.GetFileName(txtPath + sname) = True Then
        Kill txtPath + sname
        MsgBox "File Deleted"
      End If

txtpath is the path to C:\Documents and Settings\All Users\Start Menu\Programs\Startup

where in startup i have an shortcut file
fso.getfilename doesnt find the shortcut file .

I want the method to find the shortcut file and delete it

Code for it Please

coollife
Junior Poster in Training
85 posts since Aug 2009
Reputation Points: 6
Solved Threads: 0
 

As per attachment, this will put you on the right track.

You don't need the Windows Scripting Host or the System File Object.
And it doesn't mess with the registry.

Why add the dependencies or risk being flagged a Virus risk?

The download contains the Shortcuts and Special Folders module and it has a form for testing some of the module procedures.

The GetSpecialFolderPath function uses an Enum to make it easy to use.

I believe this will work on Win98 and up.

This module should be able to make shortcuts anywhere and has subs specifically for making them on the Desktop, in Programs Menu, and in Startup Menu

Attachments ShortcutsAndSpecialFolders_1.01_.zip (6.3KB)
AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You