Saving Files

R

RobcPettit

Hi, I have some csv files which, when I open I add a top line then save
as a normal excel file, then I convert the excel file to a metastock
file. I have alot of these files so Ive tried to automate this. I used
the Record Macro option, opened the csv file added my info, closed file
saving as excel file then stopped macro. Went to my conversion software
and concerted to metastock, no problem. But when I run the macro back
my conversion software has an error, saying unable to open file. When I
do it manually again no problem.
Dim fstLine(1 To 6) As Variant

fstLine(1) = "DATE"
fstLine(2) = "OPEN"
fstLine(3) = "HIGH"
fstLine(4) = "LOW"
fstLine(5) = "CLOSE"
fstLine(6) = "VOLUME"
ChDir "H:\ShareScope-Excel Data To Trim"
Workbooks.Open Filename:="H:\ShareScope-Excel Data To Trim\AAL.csv"

Rows("1:1").Select
Selection.Insert Shift:=xlDown
Range("A1").Select
Selection.Resize(LBound(fstLine, 1), 6) = fstLine

ChDir "H:\Trimmed DaTa"
ActiveWorkbook.SaveAs Filename:="H:\Trimmed DaTa\AAL.xls",
FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False
ActiveWorkbook.Close

Any Ideas
Regards Robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top