VbScript and the Shell object

Posted on 2005-03-01
Medium Priority
Last Modified: 2009-07-29
I am working in VBScript and need to open a separate application and load a .dat file into it.  

The following code allows me to open the application:
               Sub CallLogPlot
            Dim appShell
            Set appShell = CreateObject("WScript.Shell")
            Call appShell.Run("C:\Progra~1\LogPlo~1\LP2003.exe", 1, True)
            Set appShell = Nothing
               End Sub

I need to open the file now.  It  can be opened using command line:

              "For example, to start up LogPlot and load the data file named "project_a.dat", you would use
               the following command line:

               Logplot2003.exe c:\data\project_a\project_a.dat"

I don't know how to run the command prompt programmatically and add this line.  What is the best way to accomplish this task?

Thanks in advance,
Question by:sarahjackel
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 86

Accepted Solution

Mike Tomlinson earned 2000 total points
ID: 13433470
You can put the filename right into the Run() command then:

    Sub CallLogPlot
          Dim appShell
          Set appShell = CreateObject("WScript.Shell")
          Call appShell.Run("C:\Progra~1\LogPlo~1\LP2003.exe c:\data\project_a\project_a.dat", 1, True)
          Set appShell = Nothing
    End Sub

You may have to convert your filename into a short one as you have done with LP2003.exe or you may have to enclose the filename in quotes.


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…
Suggested Courses
Course of the Month12 days, 13 hours left to enroll

777 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