Solved

Reading parameters

Posted on 1998-07-01
1
116 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

706 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now