Command Line Options

Posted on 2003-03-15
Medium Priority
Last Modified: 2010-05-01
I have a problem. On my spalsh screen I test if there is a determined file using this code:

    ' Check command options
    If Command <> "" Then
        If Chr(34) <> Left(Command, 1) Then
            FileName = Command
            lencommand% = Len(Command) - 2
            FileName$ = Mid(Command, 2, lencommand%)
        End If
    End If
    ' check file
    On Error GoTo nofile:
    Dim strTemp As String * 1
    Dim i As Integer
    i = 0
    Open "file.txt" For Input As 1#
    Do Until EOF(1)
    i% = i% + 1
    Line Input #1, strTemp
    Close #1
    If i% <> 70 Or FileLen("file.txt") <> 6368 Then
    MsgBox "No file"
    End If

This works fine if there is no command line. When I drag a file to the aplication icon it causes an error opening the file that I want to check. Is there anything I can do? I don't understand why. It's supposed to open and check file.txt wherever the aplication is. (this file will be there as well)

Thank you
Question by:igfp
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

Accepted Solution

GERTJAN earned 200 total points
ID: 8142377
On wich line is the error occuring and what is the specific error description?

When the error is that the program can not locate the path then you can try

Open App.Path & "\file.txt" For Input As 1#


Author Comment

ID: 8142411
that's it!!! Apparently once there is a command line input it confunds everything (no idea why) but telling the program to open on App.Path corrects the problem! Excellent!
Thank you!

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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

764 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