Results 1 to 2 of 2

Thread: Need help in running files

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2001
    Posts
    5

    Question Need help in running files

    Hi, got a file that needs to be run e.g an execute file abc.exe
    so in oder to run the file I use a shell command
    Retval= Shell ("c:\abc.exe",1) 'Run abc.exe

    What happens when the file is placed in another folder in c:\ but all we know is it's file name only.

    Is there another way to find the file and run it.

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    Option Explicit
    'Use Shelldef to open a file with the associated app
    
    '
    Private Declare Function ShellEx Lib "shell32.dll" Alias _
    "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
    ByVal lpFile As String, ByVal lpParameters As Any, _
    ByVal lpDirectory As Any, ByVal nShowCmd As Long) As Long
    '
    Sub ShellDef(strFileName)
    Dim x
    x = ShellEx(Form1.hwnd, "open", strFileName, "", "", 1)
    End Sub
    
    Private Sub Form_Load()
    '
    Dim strYourFileVariable$
    strYourFileVariable = "excel.exe"
    ShellDef strYourFileVariable
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width