The following Excel Macro will convert the IBD XLS file into a MS SYM file automatically and save it in the Downloader directory. It creates a unique file for each date, but will overwrite an existing SYM file if the macro is run on the same set of data more than once. It does not adjust your original XLS file in any way. Feedback is welcome!
Note: You will need to modify the 'targetFile' path to reflect your Downloader path.
Note: You will need to modify the 'Selection.FormulaR1C1' line to remove the "us;" prefix if you do not receive QC data.
[code:1:176658599e]
Sub IBDConversion()
' Convert Investors Business Daily XLS to MetaSock SYM
' Written by G. Stockman, 2004-2006. All rights reserved.
' Updated: June 4, 2006 @ 2050 CST
' Supress screen updates
Application.ScreenUpdating = False
' Remember date of market close
Dim dString As String
dString = Range("A2").Value
Dim strSplit() As String
strSplit = Split(dString, " ")
dString = strSplit(3)
' Format date (remove string separators)
Dim pos As Integer
pos = InStr(dString, "/")
dString = Left(dString, pos - 1) & Mid(dString, pos + 1)
pos = InStr(dString, "/")
dString = Left(dString, pos - 1) & Mid(dString, pos + 1)
' Copy raw source data to a new workbook
Range("B7:C106").Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
' Create SYM compatible template
Range("A1:A100").Select
Selection.EntireColumn.Insert
Selection.FormulaR1C1 = "=RC[1] & "","" & ""us;"" & RC[2] & "","" & ""N/A"" & "","" & ""0"" & "","" & ""0"""
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
' Delete raw source code
Columns("B:C").Select
Selection.Delete
' Save new SYM file
Dim targetFile As String
targetFile = "C:\\Program Files\\Equis\ he DownLoader\\ibd100_" & dString & ".sym"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=targetFile, FileFormat:=xlTextPrinter, CreateBackup:=False
Application.DisplayAlerts = True
' Close temporary workbook
ActiveWorkbook.Close False
Range("A1").Select
' Resume screen updates
Application.ScreenUpdating = True
' Completion alert
MsgBox ("Conversion completed!")
End Sub
[/code:1:176658599e]
Convert the XLS data:
To SYM data: