Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15990

Conditionally Run & move the .bat file shortcut(i.e .lnk file) by vba macro

$
0
0
Code:

Public Declare PtrSafe Function ShellExecute _
 Lib "shell32.dll" _
 Alias "ShellExecuteA" ( _
 ByVal hwnd As Long, _
 ByVal lpOperation As String, _
 ByVal lpFile As String, _
 ByVal lpParameters As String, _
 ByVal lpDirectory As String, _
 ByVal nShowCmd As Long) _
As Long
Sub FFF()
Dim strFileName As String
Dim strFileExists As String
 
 strFileName = "C:\Users\WolfieeeStyle\Desktop\Close Excel.lnk"
 strFileExists = Dir(strFileName)
 
 If strFileExists = "" Then
 Set FSO = CreateObject("scripting.filesystemobject")
 FSO.MoveFile Source:="C:\Users\WolfieeeStyle\Desktop\Close Excel.lnk", Destination:="C:\Users\WolfieeeStyle\Desktop\WolfieeeStyle\9.15\"
 ShellExecute 0, "OPEN", "C:\Users\WolfieeeStyle\Desktop\WolfieeeStyle\9.15\Close Excel.lnk", "", "", 1
 Else
 
 End If
 
End Sub

I am looking for a macro that will

First Check Close Excel.lnk is located or not & if it is located then move that Close Excel.lnk to C:\Users\WolfieeeStyle\Desktop\WolfieeeStyle\9.15\ & then run that Close Excel.lnk

& If the Close Excel.lnk file is not located then do nothing
This macro is not working i think it has issues



Thnx

Viewing all articles
Browse latest Browse all 15990

Latest Images

Trending Articles



Latest Images