LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 310
Default Turn off read only attribute on shortcut

I'm trying to delete a shortcut off the users desktop programmatically. Here
is the code I have for checking if the file exists and deleting it.
Unfortunately I can't delete it because its read only! Please help!

Function SeeIfShortcutExists()
Dim WSHShell As Object
Dim MyShortcut As Object
Dim DesktopPath As String
Dim blnFile As Boolean
Set WSHShell = CreateObject("WScript.Shell")
DesktopPath = WSHShell.SpecialFolders("Desktop")
Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\" &
"Consolidated - Approve" & ".lnk")

blnFile = Len(Dir(MyShortcut))
End With

MsgBox blnFile

If blnFile = True Then
Kill (DesktopPath & "\" & "Consolidated - Approve" & ".lnk")
End If


End Function

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot remove Read Only Attribute Richard Hollister Excel Discussion (Misc queries) 6 April 20th 07 04:26 PM
Cannot remove read only attribute Colin Gough Excel Discussion (Misc queries) 2 September 27th 06 12:37 AM
Tried changing a file attribute from read only but I get error msg willymoore809 Excel Discussion (Misc queries) 5 June 5th 06 01:25 PM
Export CSV File, set Windows Read-Only attribute InNeedOfHelp! Excel Programming 1 January 27th 05 07:31 PM
Read Only attribute disappears Ken G. Excel Discussion (Misc queries) 1 December 2nd 04 12:32 AM


All times are GMT +1. The time now is 04:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"