Results 1 to 5 of 5

Thread: Shell error??? File not found

  1. #1

    Thread Starter
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    I am trying to use the shell function to execute a program from my code and I am getting the error file not found, but if I copy the path to the run dialog box it executes the EXE fine. I cannot figure out why this is happening. If anyone can help I would really appreciate it.

    Thanks in advance

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

    syntax...maybe...

    here's an example..let's see your code and your path

    Dim RetVal
    RetVal = Shell("C:\WINDOWS\notepad.exe C:\WINDOWS\mytext.txt", 1)
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3

    Thread Starter
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    My Code

    This is what my code does:

    Code:
    shell "C:\Program Files\3dfx\VisualReality\TV\3dTv.exe"
    it doesnt work, but I copied it from the shortcut and if I pasted it into the run dialog it executes.



    Code:
    shell "c:\program files\Microsoft Office\office\winword.exe"
    works fine.

    I am completely puzzled????

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

    Unhappy ..so am I...

    Shell "C:\Program Files\Birthday Reporter\birthdays.exe"

    this runs my exe from within program files..
    check your path...ie..go to your exe through
    windows explorer..find your exe and right click to
    get it's path and then copy it into your shell
    statement...add the pgm.exe to it and it should work.

    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  5. #5
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Thumbs up ShellExecute API

    Juz use the ShellExecute API is much more better then the ordinally Shell f unction.

    Code:
    Option Explicit
    Private 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
    Private Const SW_SHOWNORMAL = 1
    Private Sub Form_Load()
    ShellExecute Me.hwnd, vbNullString, <Your FileName Here>, vbNullString, "C:\", SW_SHOWNORMAL
    End Sub

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