+ Reply to Thread
Results 1 to 3 of 3

call shell from VBA

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    call shell from VBA

    Can a button be placed on an excel spreadsheet that when clicked runs a shell. I have Cygwin installed on a windows 7 machine with excel 2010 that I would like a user to press a button to run a shell script. Currently, I run it with
     bash ~/newbatch.sh
    , but I am trying to avoid any scripting. Thank you .

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: call shell from VBA

    Call Shell("bash ~/newbatch.sh", vbNormalFocus)
    If someone has helped you then please add to their Reputation

  3. #3
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: call shell from VBA

     Call Shell("bash ~/newbatch.sh", vbNormalFocus)
    File not found.

    I used to run
    VB
     Private Sub CommandButton1_Click()
    Dim cmd As String
    Dim ret As Double
    Dim WshShell As Object
    Dim plink_object As Object
    
    ' Run Linux Commands
    Set WshShell = CreateObject("WScript.Shell")
    On Error Resume Next
    Set plink_object = WshShell.Run("C:\cygwin\bin\mintty.exe C:\cygwin\home\cmccabe\ newbatch.sh 66 ""50602_15:56:31_15:56:11_15:56:21;50602_15:57:07_15:56:47_15:56:57""", 1)
    On Error GoTo 0
    that seemed to work but now cygwin opens and then closes right away. Im not sure if there is a better way or what I am doing wrong? Thank you .

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Call Shell - return code?
    By swoop99 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-09-2013, 09:18 AM
  2. Problem using shell to call batch file or cmd prompt
    By nickf829 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-09-2011, 10:27 PM
  3. Comma is Stopping My Shell("explorer.exe") Call
    By dgilray in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-05-2011, 08:25 PM
  4. CALL SHELL doesn't recognise the directory
    By plancast in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-14-2009, 12:00 PM
  5. Shell Invalid Procedure call or argument
    By rgans in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-05-2005, 12:23 PM

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