Solved

Reading parameters

Posted on 1998-07-01
1
123 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month5 days, left to enroll

636 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