It has been a long, long time since I been to Tek-Tips -- the site is great, just a severe lack of time.
And I am stumped.
I want to delete links to the web sites that Microsoft automatically populates into the end users' favourites when installing Internet Explorer.
* My code works fine for deleting regular files.
* I believe I have the correct and proper names for these special files.
* I can cut and paste the value straight from the variable when running the VB code into a DOS prompt and the file is recognized and deleted.
The issue is that VBA does not seem to recognize that the special URL files exists...
If FSO.FileExists(URLlinkFile.url)
Specifically, I can delete MSN.com.url at the command line, but not within the VBA code.
Code Snipette...
One more thing...
I can take out the FileExist and the FSO.DeleteFile or 'stCmd = "cmd /c del " & strFile works just fine.
Comments or suggestions?
Richard
And I am stumped.
I want to delete links to the web sites that Microsoft automatically populates into the end users' favourites when installing Internet Explorer.
* My code works fine for deleting regular files.
* I believe I have the correct and proper names for these special files.
* I can cut and paste the value straight from the variable when running the VB code into a DOS prompt and the file is recognized and deleted.
The issue is that VBA does not seem to recognize that the special URL files exists...
If FSO.FileExists(URLlinkFile.url)
Specifically, I can delete MSN.com.url at the command line, but not within the VBA code.
Code Snipette...
Code:
' Variables correctly initialized above
strRoot = "\\ADserver\UserProfiles\"
strFavourites = "\Favorites"
strMicrosoftLinks = "MSN.com.url Radio Station Guide.url Free Hotmail.url " _
& "Windows Marketplace.url Windows Media.url"
' non relevent code in between
If FSO.GetSpecialFolder(strFolder) Then
strTemp = strMicrosoftLinks
intZ = Len(strTemp)
intDeleted = 0
Do While intZ
'I have used underscore for delimination between files
intY = InStr(1, strTemp, "_")
If intY Then
strFile = strQ & strFolder & "\" & Left(strTemp, intY - 1) & strQ
strTemp = Mid(strTemp, intY + 1, intZ - intY)
intZ = Len(strTemp)
Else
'End if string
strFile = strQ & strFolder & "\" & strTemp & strQ
strTemp = ""
intZ = 0
End If
[b]If FSO.FileExists(strFile) Then[/b]
' Same results with either using FSO or command line
FSO.DeleteFile
' Alternate command line approach
'stCmd = "cmd /c del " & strFile
'Call Shell(stCmd, 0)
intDeleted = intDeleted + 1
' AND YES, I have also used FSO file extensions to
End If
Loop
strMsg = strProcessed & intDeleted
End If
' More code below
One more thing...
I can take out the FileExist and the FSO.DeleteFile or 'stCmd = "cmd /c del " & strFile works just fine.
Comments or suggestions?
Richard