Calling Shell from VBA

jjcarter1988

New Member
Joined
Nov 24, 2013
Messages
28
Hi All,

I am wondering how to use the Shell feature in VBA to call a terminal (using mac), then run a perl script called read_scalepack.pl on a log file that I have chosen using GetOpenFileName.

Right now I am just using Terminal to issue the .pl script (its parsing a log file) and then importing the results in excel workbook.

My terminal command looks like this: read_scalepack.pl example.log > example.csv

I turn the parsed log file into a csv file so I can import correctly into excel using delimiters.

So far I have:

Code:
    Dim logFileName As Variant
    
logFileName = Application.GetOpenFilename(FileFilter:="")
If logFileName = False Then Exit Sub

This lets me choose the log file I want. I suppose the next part may look something like:

Code:
Call Shell("read_scalepack.pl" & "logFileName")

Obviously I'm stuck there. I am not sure how to turn it into a csv file or if I need to. Also not sure how to specify to create everything in the directory that I have chosen the log file from.

Any help would be most appreciated.
 

Some videos you may like

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Watch MrExcel Video

Forum statistics

Threads
1,109,360
Messages
5,528,237
Members
409,809
Latest member
VICKRAM

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top