Ver Mensaje Individual
  #6 (permalink)  
Antiguo 13/03/2012, 12:53
Avatar de juvealexis
juvealexis
 
Fecha de Ingreso: marzo-2012
Ubicación: Ciudad Ojeda, Venezuela
Mensajes: 4
Antigüedad: 12 años, 2 meses
Puntos: 0
Respuesta: pasar de archivo txt a un formato excel con un boton enlazada con una mac

Hola mrocf gracias por la ayuda no habia comentado mas porque ando muy ocupado con la tesis y con las pasantias. Te comento que logre hacerlo lo que queria y les dejo el codigo por si alguien mas necesita saber como es.

Option Explicit
Dim f As Variant
Dim a As Workbook
Dim w As Workbook
Public ws As Worksheet
Dim iCount As Integer

Sub ImportData()
Application.ScreenUpdating = False
Set a = ActiveWorkbook

' Usuario puede elegir el archivo .txt a usar
f = Application.GetOpenFilename("Abrir archivo de texto (*.txt),*.txt")

' Abre e importa y renombra la hoja, ademas convierte el texto en columna
If f = False Then Exit Sub
Workbooks.OpenText Filename:=f, _
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, OtherChar _
:=":", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, _
1)), TrailingMinusNumbers:=True
Set w = ActiveWorkbook
w.Sheets(1).Name = "Temp"

' Copiar datos a la hoja principal
w.Sheets(1).Copy After:=a.Sheets(a.Sheets.Count)
Set ws = ActiveSheet
w.Close SaveChanges:=False
Set w = Nothing
Set a = Nothing
ActiveCell.CurrentRegion.Select
Application.ScreenUpdating = True
End sub