Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Reading parameters

Posted on 1998-07-01
1
Medium Priority
?
124 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 400 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

704 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