Tuesday, May 01, 2007

Visual Basic Command Line Arguments

Retrieve Command Line Arguments from a Microsoft Visual Basic or an executable program developed with Visual Basic from Command Line

Sub Command_Line_Call()

sCmdText = Trim$(Command$)

' You can give multiple parameters through command line with specific delimiters

arCmdData = Split(sCmdText, ",")
If arCmdData(0) = "PRG1" Then
Exec_PRG1 (arCmdData(1))
ElseIf arCmdData(0) = "PRG2" Then
Exec_PRG2 (arCmdData(1))
If arCmdData(0) = "PRG3" Then
Exec_PRG3 (arCmdData(1))
End If


End Sub

' Retrieve Command Line Arguments, Launch PRogram from command, Execute Visual Basic Program from Command Line

2 comments:

  1. Anonymous8:55 AM

    You may wish to try this instead:
    arCmdData = Split(sCmdText, ",")
    If arCmdData(0) = "PRG1" Then
    Exec_PRG1 (arCmdData(1))
    ElseIf arCmdData(0) = "PRG2" Then
    Exec_PRG2 (arCmdData(1))
    ElseIf arCmdData(0) = "PRG3" Then
    Exec_PRG3 (arCmdData(1))
    End If

    ReplyDelete
  2. i have a application in which the operator runs the end of day manually everyday. He clicks on the application and the EOD form is launched where he clicks some options (like backup preferences , Start of day block etc). Now i want to automate this process. Can anyone please let me know what how we can execute this exe through a command line.

    ReplyDelete

StumbleUpon
Share on Facebook
Related Posts Plugin for WordPress, Blogger...

Visual Basic for Applications (VBA) Forum (recent threads)

CodeKeep VBA Feed

Visual Studio Tools for Office Forum (recent threads)

Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.

Office Business Applications (OBA) Team Blog

MSDN Code Gallery Published Resources For Tag VSTO

microsoft.public.vsnet.vstools.office Google Group