Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2003
    Location
    Hertfordshire, England
    Posts
    78

    Unanswered: Shell Wrong Number of Arguments

    I am trying to call my vb program and pass it 3 arguments. It works fine in vb and also from the run command in windows. e.g.

    "C:\VB.NET Projects\TEST\emailer\emailer.exe" "email@address.com" "Subject" "Body"

    That works fine in vb or at the run command.

    In Access I am using this and it won't work:

    Code:
    x = Shell("C:\VB.NET Projects\TEST\emailer\emailer.exe", "email@address.com", "Subject", "Body")
    All I get it "wong number of arguments or invalid property assignment".

    How can I get it to work?

    Neil.

  2. #2
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580

    x Marks the spot...

    Hi Neil,

    If this part of a function?

    Can you post a bit more of the code pls?

    What type of object is x declared as?
    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

  3. #3
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Try this:

    Shell """C:\VB.NET Projects\TEST\emailer\emailer.exe"" ""email@address.com"" ""Subject"" ""Body"""


    Good luck
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  4. #4
    Join Date
    Sep 2003
    Location
    Hertfordshire, England
    Posts
    78
    Thanks for that new code it works fine

  5. #5
    Join Date
    Sep 2003
    Location
    Hertfordshire, England
    Posts
    78
    Just a thought can I get the same code to work using variables as the arguments? I'll have a go myself this morning but will probably be back for help

  6. #6
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Yes. But it would make for a more complex command:

    Shell """C:\VB.NET Projects\TEST\emailer\emailer.exe"" """ & strEmailAddressVariable & """ """ & strSubjectVariable & """ """ & strBodyVariable & """"

    Hopefully I have that right ^^
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  7. #7
    Join Date
    Sep 2003
    Location
    Hertfordshire, England
    Posts
    78
    This work perfect.

    Thanks so much.

  8. #8
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Great Glad I could help
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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