VBA Kill command for a file on desktop

Johndinho

Board Regular
Joined
Mar 21, 2013
Messages
85
Hi,

I want to delete a file on the desktop but want to do it without specifying the \user\ directory.

I'm using
Code:
CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\Docs.pdf"
How do I designate the desktop as the directory to delete Docs.pdf from?

Any help would be appreciated as usual

John
 

Some videos you may like

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Johndinho

Board Regular
Joined
Mar 21, 2013
Messages
85
Found it..

Code:
    Dim oWSHShell As Object


    Set oWSHShell = CreateObject("WScript.Shell")
    Kill oWSHShell.SpecialFolders("Desktop") & "\ShippingDocs.pdf"
 

Forum statistics

Threads
1,089,662
Messages
5,409,598
Members
403,271
Latest member
Rajeev Muraleedharan

This Week's Hot Topics

Top