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...
Printable View
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...
The Command() Function will return the parameters passed to the program as one string. You need to split that up yourself.This given that you're actually using Sub Main as the start object of the project.VB Code:
Public Sub Main() Dim sArgs() As String Dim i As Long sArgs = Split(Command, " ") For i = 0 To UBound(sArgs) MsgBox "Argument number " & i + 1 & " = " & sArgs(i) Next End Sub
This Worked! Thank you for sharing this with me. :wave: :thumb: