Saltar al contenido
View in the app

A better way to browse. Learn more.

Ayuda Excel

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Macro que cargar archivos .txt en hoja resumen

publicado

Buenas super genios del blog.

Soy bastante novato en las macros pero al mismo tiempo soy muy travieso con ellas lo cual me ha dado excelentes resultados laborales y personales.

Bueno mi duda es como hacer que esta macro que me funciona genial ( y encontrada en un foro, solo que le hice leves modificaciones), me cargue el archivo .txt que se llama igual a lo concatenado en un especifica celda (O1) y no solo el libro que esta indicado en la macro, como lo hago dinámico a mi celda O1 y no a estar poniendo la dirección del archivo en la macro manualmente.

adjunto macro.


Sub Cargar_Resumen()


Ubica = Range("K1")


With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;[B]C:\Users\lesth_000\Desktop\NOMINA\Nomina Bodega 25092013.txt[/B]", Destination:=Range(Ubica))
[COLOR=#008000]'cambiar esta direccion por la que se concatena en la celda O1'[/COLOR]

.Name = "Nomina Bodega 25092013._1"
.FieldNames = True
.RowNumbers = True
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 1252
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(2, 18, 2, 11, 18, 2, 11, 2, 50)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With


End Sub


[/CODE]

De antemano gracias!

[color=blue]- - - - - Mensaje combinado - - - - -[/color]

Ademas los .txt estan en la misma carpeta del libro de excel!! saludos

Featured Replies

publicado

Pura vida lestherchaga

Si te entendí bien prueba esta modificación:

Sub Cargar_Resumen()Ubica = Range("K1")
pach = ActiveWorkbook.Path


With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & pach & "\" & [O2] & ".txt", Destination:=Range(Ubica))
'cambiar esta direccion por la que se concatena en la celda O1'


.Name = "Nomina Bodega 25092013._1"
.FieldNames = True
.RowNumbers = True
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 1252
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(2, 18, 2, 11, 18, 2, 11, 2, 50)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With


End Sub[/CODE]

Salu2

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.