#excel vba
Dim i As Integer
Dim WS_Count As Integer
file = "z:\workbook.xlsx"
csv = "z:\workbook.csv"
WS_Count = ActiveWorkbook.Worksheets.Count
For i = 1 To WS_Count
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets(i)
ws.Copy
ActiveWorkbook.SaveAs Filename:=csv, _
FileFormat:=xlUnicodeText
Next i
Application.DisplayAlerts = False
ActiveWorkbook.Close
Shell ("ruby X:\excel\send.rb")
Do
If Dir(file) <> "" Then
Exit Do
End If
DoEvents 'Prevents Excel from being unresponsive
Application.Wait Now + TimeValue("0:00:01") 'wait for one second
Loop
Workbooks.Open file