Results 1 to 3 of 3

Thread: How to Pass Parms to Batch VB6 app???

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2005
    Location
    Basking Ridge, NJ
    Posts
    4

    Smile How to Pass Parms to Batch VB6 app???

    I use VB6 as MyProg.exe in batch file, no forms, and I need to pass parameters to the program. SUB MAIN(Parm1 as string) ???

    C>MyProg.exe parm1 parm2

    Any Ideas? I can't figure this out...

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: How to Pass Parms to Batch VB6 app???

    The Command() Function will return the parameters passed to the program as one string. You need to split that up yourself.
    VB Code:
    1. Public Sub Main()
    2.     Dim sArgs() As String
    3.     Dim i As Long
    4.  
    5.     sArgs = Split(Command, " ")
    6.     For i = 0 To UBound(sArgs)
    7.         MsgBox "Argument number " & i + 1 & " = " & sArgs(i)    
    8.     Next
    9. End Sub
    This given that you're actually using Sub Main as the start object of the project.

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2005
    Location
    Basking Ridge, NJ
    Posts
    4

    Re: How to Pass Parms to Batch VB6 app???

    This Worked! Thank you for sharing this with me.

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