以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [原创]能将CSV2XLS转为狐表代码吗? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=84802) |
-- 作者:lxy060669 -- 发布时间:2016/5/10 22:56:00 -- [原创]能将CSV2XLS转为狐表代码吗? 下面是VAB写的CSVtoXLS代码,能转为适用于狐表的代码? ‘----- Sub CSV2XLS() Dim FilePath, MyFile, iPath As String iPath = ThisWorkbook.Path MyFile = Dir(iPath & "\\*.CSV") If MyFile <> "" Then Do On Error Resume Next If MyFile = ThisWorkbook.Name Then MyFile = Dir Workbooks.Open (iPath & "\\" & MyFile) MyFile = Replace(MyFile, ".csv", ".xls") Name = "\\" & MyFile FilePath = iPath & Name Application.ScreenUpdating = False ActiveWorkbook.SaveAs Filename:=FilePath, FileFormat:= _ xlNormal, CreateBackup:=False Workbooks(MyFile).Close True Application.ScreenUpdating = True MyFile = Dir Loop While MyFile <> "" End If End Sub ’----- 先行谢谢! |
-- 作者:大红袍 -- 发布时间:2016/5/10 23:36:00 -- 参考代码
Dim App As New MSExcel.Application |
-- 作者:lxy060669 -- 发布时间:2016/5/10 23:55:00 -- 感谢老师指点 感谢!! 我用了格式为xlworkbookNormal, 谢谢! \'------ Dim App As New MSExcel.Application app.DisplayAlerts = False Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open("D:\\test.csv") Wb.SaveAs(Filename:="d:\\test.xls", FileFormat:=MSExcel.XlFileFormat.xlWorkbookNormal) wb.close app.quit
|
-- 作者:lhpc120 -- 发布时间:2016/5/11 11:05:00 -- ?? |