+ Reply to Thread
Results 1 to 8 of 8

running another application from VBA

  1. #1
    Registered User
    Join Date
    12-26-2005
    Posts
    4

    Question running another application from VBA

    Hello,

    I m working on a macro that will basically sort, filter and subtotal the data. The data to be used is available in another application wherein i can run a query and get the data in excel friendly format. to get such data i need to click some options manually which i want to avoid

    Can anyone suggest if there any function or command so that i can run the application other than excel and get data from such and manipulate it in excel.

    Such application is not registered in objects library if excel.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Sudhaca,

    You can start any program using the Shell command. The program file type (extension) must be registered for this to work. Windows uses the extension to look up the program that will open the file.

    Shell Command Example:
    Dim RetVal
    RetVal = Shell("C:\WINDOWS\CALC.EXE", 1) ' Run Calculator

    Windows 2000
    To create a file association for an unassociated file type:
    1. In My Computer or Windows Explorer, right-click a file with the extension whose association that you want to create, and then click Open. Or, double-click the file.

    2. In the Open With dialog box, choose a program to associate with this file name extension. Click the Always use the selected program to open this kind of file option.


    Windows XP
    To create file association:
    1. Right-click a file with the extension that you want to change, and then click Open, or double-click the file.

    2. Windows XP displays a dialog box that indicates that no program is associated with this file. The dialog box offers two choices for creating an association:• Use the Web service to find the appropriate program
    • Select the program from a list
    Unless you want to find and download software that opens this file type, the best choice is to select the program from a list.


    3. Windows displays a dialog box that displays programs that are installed on the computer. If the program that you want to use for this file type is not listed, click Browse to locate the appropriate software. Select the Always use the selected program to open this kind of file check box.

    Suncerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    12-26-2005
    Posts
    4

    Question Thanks. But problem not solved

    Hi Leith,

    Thanks for ur response.
    I was not very clear in informing the help i need in my first post. Please go through below.

    I have to use the data which will be genereated from a special database application(non microsoft) by running a query. That application is registered in the reference library of VBA.
    I need a code which will run a query executable to that particular application only. The query file name has extension of ".rep".
    From that query i can export the data into excel and manipulate it.

    I think there are some commands like 'set object' 'set class' data souurce="provider" etc.

    I want to know how to use those commands.

    Regards
    Sudhanshu

  4. #4
    Curt
    Guest

    Re: running another application from VBA

    Is it possible to execute excel from within a execl vba file? Problem I am
    facing is a computer that does not have excel on it. Have excel on cd with
    file. Need to be able to run and safe work done on file. Feel that file can
    be saved onto hd of computer by chging attribs. Its the loading and running
    of excel that has got me.
    Thanks
    Curt

    "Leith Ross" wrote:

    >
    > Hello Sudhaca,
    >
    > You can start any program using the Shell command. The program file
    > type (extension) must be registered for this to work. Windows uses the
    > extension to look up the program that will open the file.
    >
    > SHELL COMMAND EXAMPLE:
    > Dim RetVal
    > RetVal = Shell("C:\WINDOWS\CALC.EXE", 1) ' Run Calculator
    >
    > WINDOWS 2000
    > To create a file association for an unassociated file type:
    > 1. In My Computer or Windows Explorer, right-click a file with the
    > extension whose association that you want to create, and then click
    > Open. Or, double-click the file.
    >
    > 2. In the Open With dialog box, choose a program to associate with this
    > file name extension. Click the Always use the selected program to open
    > this kind of file option.
    >
    >
    > WINDOWS XP
    > To create file association:
    > 1. Right-click a file with the extension that you want to change, and
    > then click Open, or double-click the file.
    >
    > 2. Windows XP displays a dialog box that indicates that no program is
    > associated with this file. The dialog box offers two choices for
    > creating an association:• Use the Web service to find the appropriate
    > program
    > • Select the program from a list
    > Unless you want to find and download software that opens this file
    > type, the best choice is to select the program from a list.
    >
    >
    > 3. Windows displays a dialog box that displays programs that are
    > installed on the computer. If the program that you want to use for this
    > file type is not listed, click Browse to locate the appropriate
    > software. Select the Always use the selected program to open this kind
    > of file check box.
    >
    > Suncerely,
    > Leith Ross
    >
    >
    > --
    > Leith Ross
    > ------------------------------------------------------------------------
    > Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
    > View this thread: http://www.excelforum.com/showthread...hreadid=496024
    >
    >


  5. #5
    Registered User
    Join Date
    12-26-2005
    Posts
    4

    Please help

    Hello did any one had achance to look on below.

    Please advise me.

  6. #6
    NickHK
    Guest

    Re: running another application from VBA

    Sudhanshu,
    You can run a query from Excel. Check out Data>Get External Data>New
    Database Query.
    Recording a macro whilst you do this will give the basis of the VBA code.

    NickHK

    "sudhaca" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi Leith,
    >
    > Thanks for ur response.
    > I was not very clear in informing the help i need in my first post.
    > Please go through below.
    >
    > I have to use the data which will be genereated from a special database
    > application(non microsoft) by running a query. That application is
    > registered in the reference library of VBA.
    > I need a code which will run a query executable to that particular
    > application only. The query file name has extension of ".rep".
    > From that query i can export the data into excel and manipulate it.
    >
    > I think there are some commands like 'set object' 'set class' data
    > souurce="provider" etc.
    >
    > I want to know how to use those commands.
    >
    > Regards
    > Sudhanshu
    >
    >
    > --
    > sudhaca
    > ------------------------------------------------------------------------
    > sudhaca's Profile:

    http://www.excelforum.com/member.php...o&userid=29892
    > View this thread: http://www.excelforum.com/showthread...hreadid=496024
    >




  7. #7
    Curt
    Guest

    Re: running another application from VBA

    Follow shell command Am at a loss? computer has msworks so does not read
    excel need to pull excel up from a cd to run. Can this be done from a cd. My
    program is also on cd. This can be saved on machine by chg attrb.
    Any help greatly appreciated.
    Curt
    [email protected]

    "Leith Ross" wrote:

    >
    > Hello Sudhaca,
    >
    > You can start any program using the Shell command. The program file
    > type (extension) must be registered for this to work. Windows uses the
    > extension to look up the program that will open the file.
    >
    > SHELL COMMAND EXAMPLE:
    > Dim RetVal
    > RetVal = Shell("C:\WINDOWS\CALC.EXE", 1) ' Run Calculator
    >
    > WINDOWS 2000
    > To create a file association for an unassociated file type:
    > 1. In My Computer or Windows Explorer, right-click a file with the
    > extension whose association that you want to create, and then click
    > Open. Or, double-click the file.
    >
    > 2. In the Open With dialog box, choose a program to associate with this
    > file name extension. Click the Always use the selected program to open
    > this kind of file option.
    >
    >
    > WINDOWS XP
    > To create file association:
    > 1. Right-click a file with the extension that you want to change, and
    > then click Open, or double-click the file.
    >
    > 2. Windows XP displays a dialog box that indicates that no program is
    > associated with this file. The dialog box offers two choices for
    > creating an association:• Use the Web service to find the appropriate
    > program
    > • Select the program from a list
    > Unless you want to find and download software that opens this file
    > type, the best choice is to select the program from a list.
    >
    >
    > 3. Windows displays a dialog box that displays programs that are
    > installed on the computer. If the program that you want to use for this
    > file type is not listed, click Browse to locate the appropriate
    > software. Select the Always use the selected program to open this kind
    > of file check box.
    >
    > Suncerely,
    > Leith Ross
    >
    >
    > --
    > Leith Ross
    > ------------------------------------------------------------------------
    > Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
    > View this thread: http://www.excelforum.com/showthread...hreadid=496024
    >
    >


  8. #8
    Registered User
    Join Date
    12-26-2005
    Posts
    4

    Red face Please help

    Hello, The system which i will use is specifically used in the company i work for.However, the good news is thati have found that same application is registered into the reference library excelVBA as object.

    Now i dont know how to activate the object and use the query file which can be run only onto that application.

    Can anyone please guide me how can I write the code to activate a existing object in VBA so that macro will work as:
    1) Activate the busobj(it is shown as library
    2) activate the query(it is shown as Classes


    Thanks
    Sudhanshu

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1