Solved Open An Installer from a Shared Folder (1 Viewer)

Pac-Man

Active member
Local time
Today, 16:36
Joined
Apr 14, 2020
Messages
408
It took me a while to search and understand the Shell Execute. Source of code are this link (however I modified the code a bit). Here is the code that I used for ShellExecute if anyone else like me is looking for this:
Put the following piece of code in the declaration section of module under Option Explicit:
C:
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

Then you can put the following code anywhere in the module as a sub:
C:
Public Sub OpenFile(FileToOpen As String, Optional Params As String = "", _
                    Optional DefaultDir As String = "", Optional ShowHow As Long = 1)

    ShellExecute 0, "OPEN", FileToOpen, Params, DefaultDir, 1
End Sub

Then you can use following line of code to open any file:
C:
OpenFile sDBName 'where sDBName is the full path to the file including file name.

Best Regards,
Abdullah
 
Last edited:

Isaac

Lifelong Learner
Local time
Today, 04:36
Joined
Mar 14, 2017
Messages
8,738
Gasman helped a lot more than I did. We are both glad that you got it working.
 

Users who are viewing this thread

Top Bottom