Results 1 to 11 of 11
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Houston, Texas, USA
    Posts
    432
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do I start excel from a Script Shell (Excel 97 & 2000)

    I have two user, one uses Excel 2000 and the other 97. The one using 2000 is in drive c: and works fine. How do I get this code to open the 97 version in drive d:???

    Set objWSHShell = CreateObject("WScript.Shell")
    objWSHShell.Run("excel.exe tabsproddatabaseedgarsecurityMasterTerm.xls")

  2. #2
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: How do I start excel from a Script Shell (Excel 97 & 2000)

    dreyes

    From your post I could not tell what you are trying to do.

    I think you are trying to open a workbook on Drive D, and to do so you need to use the following example:

    Workbooks.Open Filename:="tabsproddatabaseedgarsecurityMasterTerm .xls"

    If you are trying to open a special workbook when opening Excel, the best way is to place this workbook in the XLStart folder, and that will take care of it.

    If you are trying to open a workbook from an Icon then you need to use this example:

    Place the path and file name in the Target field of the icon after the executable. This may need some specific items depending on application, and OS, so be careful.

    Hope this helps.

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  3. #3
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Houston, Texas, USA
    Posts
    432
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How do I start excel from a Script Shell (Excel 97 & 2000)

    I have 20 people that use Termination.xls, the spreadsheet is locationed on the network: tabssprod....termination.xls. If they have MSOffice-Excel97 in the C: drive it works fine. My problem is that when they have Excel in the D: drive it doesn't work. How can I get it to check c: and d: for excel?
    I use MS Outlook98 for a form. THere is a command button on there that we use to start Excel Sub

    cmdExcel_click()
    Set objWSHShell = CreateObject("WScript.Shell")
    objWSHShell.Run("excel.exe tabsprodsecurityTermination.xls")
    end sub

  4. #4
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: How do I start excel from a Script Shell (Excel 97 & 2000)

    dreyes

    Put a shortcut to the file in the XLStart folder of each machine.

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How do I start excel from a Script Shell (Excel 97 & 2000)

    Hi Daniel,

    Since you're using Outlook, use VBA to open Excel:

    <pre>Sub test()
    Dim oExcel As Object
    Set oExcel = CreateObject("excel.application")
    With oExcel
    .workbooks.Open "CATAAutochrt.xls"
    .Visible = True
    MsgBox "Excel opened"
    .activeworkbook.Close False
    .Quit
    Set oExcel = Nothing
    End With
    End Sub
    </pre>

    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  6. #6
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Houston, Texas, USA
    Posts
    432
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How do I start excel from a Script Shell (Excel 97 & 2000)

    I don't think I am having problems getting the file name. If the people that have excel on the D: drive go to a machine that has it in the c: DRIVE it work fine. I don't have a problem getting the file. It's starting excel from the D: that gives me problems. BTW, using Outlook 98/Excel 97 or Outlook 2000/Excel2000 gives me the same problem.

  7. #7
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Houston, Texas, USA
    Posts
    432
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How do I start excel from a Script Shell (Excel 97 & 2000)

    This not able to fix this problem. If a user has Excel in C: drive it works fine. But, if it is on their D: drive it work work. How can I tell it work search C: and D: drive for Excel to start?

  8. #8
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: How do I start excel from a Script Shell (Excel 97 & 2000)

    Dreyes

    Happy New Year to you. How about if you do something like:

    run Application.Path & Application.PathSeparator & "Excel.EXE"

    Now I found something called ActivateMicrosoftApp, but unfortunately it does not have Excel as one that it can do.

    Hope this helps. I still don't know what you are doing, maybe you can tell us in detail.

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  9. #9
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: How do I start excel from a Script Shell (Excel 97 & 2000)

    Daniel

    Sorry maybe I misread.

    Here is what is in the OLH for ActivateMicrosoftApp Method

    [b] <font color=blue>
    Activates a Microsoft application. If the application is already running, this method activates the running application. If the application isn't running, this method starts a new instance of the application.

    Syntax

    expression.ActivateMicrosoftApp(index)

    expression Required. An expression that returns an Application object.

    index Required Long. Specifies the Microsoft application to activate. Can be one of the following </font color=blue> <font color=red> XlMSApplication </font color=red> <font color=blue> constants: xlMicrosoftWord, xlMicrosoftPowerPoint, xlMicrosoftMail, xlMicrosoftAccess, xlMicrosoftFoxPro, xlMicrosoftProject, or xlMicrosoftSchedulePlus.

    Could that be the MS-Excel application? Or is it that since you are running it from within Excel, Excel is not there? Anyone has used this method before?

    HTH

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  10. #10
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Houston, Texas, USA
    Posts
    432
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How do I start excel from a Script Shell (Excel 97 & 2000)

    I guess explaining a little would help. I have an Outlook form that was designed for our HR dept. It contain the name of the person being terminated, Hire date, termination date, and the Dept. they work for.

    After HR fillins the information they "press" a button that will 1. forward the form to the Network Group that will disconnect their access to the Network and the Mainframe. 2. An Excel spreadsheet is opened and via a query it will pull all the names of people that have been terminated within the last 6 months. The spreadsheet is then mail to all Dept. Managers tell them not to give building access to any of them.

    My problem is that everyone in the HR dept. has access to this form and just about 95% of them have Excell on their C: drives. There are a could that have Excel on their D: drives. For some reason they are not able to start Excel and open the spreadsheet that contains the information.

  11. #11
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: How do I start excel from a Script Shell (Excel 97 & 2000)

    Daniel

    Great explanation, but still one question:

    When you say <<< For some reason they are not able to start Excel and open the spreadsheet that contains the information. >>> you mean you can't open Excel via code or that truly they are unable to do so even from Windows?

    If it is the first option, did you try and reinstall Excel, or talk to Tech-Support?

    If it is the second option, well you could visit the registry to pick up the path of an installed application. I don't know where it would be, but I have an example of how to read a registry key if that helps.

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

Posting Permissions

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