Results 1 to 5 of 5

Thread: Run-time error '5'

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715

    Run-time error '5'

    Run-time error '5':

    Invalud procedure call or argument





    and it shows up for this line:


    Code:
    x = Shell ("c:\Progra~1\VIH\VIHdata.mdb /x mcrVBSys_ExpMdl", vbNormalFocus)
    i am completely stumpted

    thanks
    Dimava
    NXSupport - Your one-stop source for computer help

  2. #2
    Member
    Join Date
    Feb 2003
    Posts
    37
    As the Shell function is only used to run executable programs, you'll have to use the ShellExecute API call.

    Code:
    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 Sub Command1_Click()
    Dim RetVal As Long
    
    RetVal = ShellExecute(Me.hwnd, "open", "c:\Progra~1\VIH\VIHdata.mdb", "/x mcrVBSys_ExpMdl", "", vbNormalFocus)
    
    End Sub

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    thanks for the reply, but why is /x mcrVBSys_ExpMdl seperated from the math to the db?

    right now it opens the DB, but it doesnt run the macro


    thanks,

    Dimava
    NXSupport - Your one-stop source for computer help

  4. #4
    Member
    Join Date
    Feb 2003
    Posts
    37
    I split that out because of the lpParameters variable. I may be incorrect in thinking that it had to be split out (notice directory does not), so you may be able to put everything in that one string. I am not certain.

  5. #5
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Good ol' Run-time error '5'
    My evil laugh has a squeak in it.

    kristopherwilson.com

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