Solved

Reading parameters

Posted on 1998-07-01
1
119 Views
Last Modified: 2010-05-03
I'm currently writing a little utility program. This program is launched with 3 parameters. I need to get the values of these parameters into my program. How do I do this?

The parameters are folders so there will be spaces in the params. They are seperated by a comma (,).

Thanks for your help
Teddy
0
Comment
Question by:tflarsen
1 Comment
 
LVL 2

Accepted Solution

by:
swilt earned 100 total points
ID: 1464663
Set up test data using
   Project
   Project Properties
   Make
   Command Line Arguments


Option Explicit

Private Sub Form_Load()
    Dim i As Integer
    Dim sCmd As String
    Dim sParams(2) As String
   
    sCmd = Command$
    sParams(0) = sChopStr(sCmd)
    sParams(1) = sChopStr(sCmd)
    sParams(2) = sChopStr(sCmd)
   
    For i = 0 To 2
        MsgBox "Param " & i & " " & sParams(i)
    Next i
End Sub

Private Function sChopStr(sInp As String) As String
    Dim p As Integer
    Dim sRet As String
   
    sInp = Trim$(sInp)
    p = InStr(sInp, ",")
    If p > 0 Then
        sRet = Left$(sInp, p - 1)
        sInp = Mid$(sInp, p + 1)
    Else
        sRet = sInp
        sInp = ""
    End If
    sChopStr = sRet
End Function

0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question