ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving Files (https://www.excelbanter.com/excel-programming/333882-saving-files.html)

[email protected][_2_]

Saving Files
 
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



All times are GMT +1. The time now is 05:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com