By using expertatexcel.com you agree to our cookie policy, We and our partners operate globally and use cookies, for multiple purposes

expertatexcel.com

 


Open Websites or Run Programs

Excel is good at opening websites and running programs

One way is via hyperlinks, but Excel through the API can also perform these tasks.



Sub RunProgram(sFile, Optional args, Optional runInFolder)
'Version: 1.000
'Purpose: This run passed sFile
  Dim RetVal As Long
  On Error Resume Next
  RetVal = ShellExecute(0, "open", sFile, "", "", SW_SHOWMAXIMIZED)
End Sub

----------

Public Declare 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