Ver Mensaje Individual
  #7 (permalink)  
Antiguo 28/08/2007, 14:15
Avatar de mrocf
mrocf
 
Fecha de Ingreso: marzo-2007
Ubicación: Bs.As.
Mensajes: 1.103
Antigüedad: 17 años
Puntos: 88
De acuerdo Duda para generar un txt con un macro

Una variante dentro del mismo esquema sería:

Código:
Sub GeneraTxt()
Dim MiRango As Range, Largo As Integer, FilaActual As Long
On Error Resume Next
Set MiRango = Application.InputBox("Seleccione rango a exportar", Type:=8)
On Error GoTo 0
    If MiRango Is Nothing Then Exit Sub
    Open "C:\TEXTO.txt" For Output As #1
For Each Celda In MiRango
    If Largo <= Len(Celda) Then Largo = 1 + Len(Celda)
Next Celda
    FilaActual = MiRango.Cells(1).Row
For Each Celda In MiRango
    If FilaActual < Celda.Row Then
        FilaActual = Celda.Row: Print #1, ""
    End If
    Print #1, CStr(Celda); Space(Largo - Len(Celda));
Next Celda
    Close #1
    Set MiRango = Nothing
End Sub 
Saludos