Sub proceso() 'por luismondelo ruta = ActiveWorkbook.Path & "\" Open ruta & "ejemplo.txt" For Output As #1 Range("a2").Select Do While ActiveCell.Offset(0, 1).Value <> "" ubica = ActiveCell.Address Do While ActiveCell.Column < 75 If ActiveCell.Value <> "" Then lista = lista & "|" & ActiveCell.Value End If ActiveCell.Offset(0, 1).Select Loop lista = Mid(lista, 2, Len(lista) - 1) Print #1, lista lista = "" Range(ubica).Offset(1, 0).Select Loop Close #1 MsgBox "Se ha creado el txt en la ruta: " & ruta End Sub
miércoles, 13 de diciembre de 2017
Macro Exportar a txt
martes, 5 de diciembre de 2017
Generacion de Alfanumerico Aleatorio
sub aleatorio()
Dim cod_ale As String
Dim Letters As New List(Of Integer)
'codigos ASCII numericos
For i As Integer = 48 To 57
Letters.Add(i)
Next
'codigos ASCII letras minusculas
For i As Integer = 97 To 122
Letters.Add(i)
Next
'codigos ASCII letras mayusculas
For i As Integer = 65 To 90
Letters.Add(i)
Next
'colocamos la cantidad de carracteres para nuestro autogenerado (6)
Dim Rnd As New Random
Dim SB As New System.Text.StringBuilder
Dim Temp As Integer
For count As Integer = 1 To 6
Temp = Rnd.Next(0, Letters.Count)
SB.Append(Chr(Letters(Temp)))
Next
cod_ale = SB.ToString
end sub
Dim cod_ale As String
Dim Letters As New List(Of Integer)
'codigos ASCII numericos
For i As Integer = 48 To 57
Letters.Add(i)
Next
'codigos ASCII letras minusculas
For i As Integer = 97 To 122
Letters.Add(i)
Next
'codigos ASCII letras mayusculas
For i As Integer = 65 To 90
Letters.Add(i)
Next
'colocamos la cantidad de carracteres para nuestro autogenerado (6)
Dim Rnd As New Random
Dim SB As New System.Text.StringBuilder
Dim Temp As Integer
For count As Integer = 1 To 6
Temp = Rnd.Next(0, Letters.Count)
SB.Append(Chr(Letters(Temp)))
Next
cod_ale = SB.ToString
end sub
Suscribirse a:
Comentarios (Atom)
Macro Exportar a txt
Sub proceso () 'por luismondelo ruta = ActiveWorkbook.Path & "\" Open ruta & "ejemplo.txt" For Output As ...
-
--Creamos una tabla temporal con un campo clave de tipo integer identity DECLARE @Tmp_Cliente TABLE( Id int identity(1,1) not null pri...
-
declare @columns nvarchar(MAX), @sql nvarchar(MAX) SET @columns = STUFF(( SELECT ',' + QUOTENAME(campo) FROM (SELECT DIST...
-
Sub proceso () 'por luismondelo ruta = ActiveWorkbook.Path & "\" Open ruta & "ejemplo.txt" For Output As ...