Tema: xls2txt
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 14/02/2008, 13:47
son_shinta
 
Fecha de Ingreso: noviembre-2007
Mensajes: 19
Antigüedad: 17 años, 1 mes
Puntos: 0
Re: xls2txt

gracias, pero nu me sirve, porke necesito exportar solo una parte dela hoja a un txt. Si a alguien le interesa hice esto: (en realidad modifique algo que encontre y quedo asi:)

Sub ExportToTextFile(FName As String, Sep As String, StartRow As Long, _
EndRow As Long, StartCol As Integer, EndCol As Integer)
Dim WholeLine As String
Dim FNum As Integer
Dim RowNdx As Long
Dim ColNdx As Integer
Dim CellValue As String
Application.ScreenUpdating = False
On Error GoTo EndMacro:
FNum = FreeFile
Open FName For Output Access Write As #FNum
For RowNdx = StartRow To EndRow
WholeLine = ""
For ColNdx = StartCol To EndCol
If Cells(RowNdx, ColNdx).Value = "" Then
CellValue = "NaN"
Else
CellValue = Cells(RowNdx, ColNdx).Value
End If
WholeLine = WholeLine & CellValue & Sep
Next ColNdx
WholeLine = Left(WholeLine, Len(WholeLine) - Len(Sep))
Print #FNum, WholeLine
Next RowNdx
EndMacro:
On Error GoTo 0
Application.ScreenUpdating = True
Close #FNum
End Sub