首页 文章

导入以使用单元格值优化文本文件

提问于
浏览
0

我有一些.txt输出文件,我想在excel中导入 .

理想情况下,我想使用Sheet1作为索引;我将在哪里写一个 Headers ,工作表的名称以及.txt文件的路径和名称 . 宏应该创建一个名为单元格的newSheet,并在该表中导入相应的.txt文件 .

我一直试图记录宏并更改VBA代码,但到目前为止只是失败 .

With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and Settings\UserXP\My Documents\My Dropbox\CIPPEC\1-MIRA\Procesamiento base\OEDE\Tablas\trim\q_employ_pcia_23.txt" _
, Destination:=Range("$A$1")).Name = "q_employ_pcia_23"

任何的想法?

谢谢

1 回答

  • 0
    With ActiveSheet.QueryTables.Add(Connection:= _
    "TEXT;C:\Documents and Settings\UserXP\My Documents\My Dropbox\CIPPEC\1-MIRA\Procesamiento base\OEDE\Tablas\trim\q_employ_pcia_23.txt" _
    , Destination:=Range("$A$1"))
    .Name = "q_employ_pcia_23"
    .Refresh BackgroundQuery:=False
    End With
    ActiveSheet.Name = "q_employ_pcia_23"
    

    用于将导入导入新工作表,并且还要为新工作表命名 .

相关问题