Código
sub main() Dim path as string path = "c:\Dir\Dir2\" & TextoAleatorio("a-z", "-", 5, 10) & ".bat" ' Esto genera un texto aleatoria que comprende las letras desde "a" hasta "z" TODAS minusculas segun el codigo asccii con longitud minima de 5 caracteres y 10 como máximo. ' Más codigo end sub Private Sub NormalizePath(ByRef sData As String) sData = IIf(Right$(sData, 1) = "\", sData, sData & "\") End Sub Function TextoAleatorio(StrRango As String, Separador As String, Optional LENTEXTMIN As Long = 1, Optional LENTEXTMAX As Long = -1) As String Dim spli() As String Dim i As Double If InStr(StrRango, Separador) > 0 Then spli = Split(StrRango, Separador) LENTEXTMAX = LENTEXTMIN + Int(IIf(LENTEXTMAX = -1, NumeroAleatorio(1, 100), LENTEXTMAX)) For i = LENTEXTMIN To LENTEXTMAX TextoAleatorio = TextoAleatorio & Chr(NumeroAleatorio(Asc(spli(0)), Asc(spli(1)))) Next i End If End Function Public Function NumeroAleatorio(MinNum As Long, MaxNum As Long) As Long Dim Tmp As Long If MaxNum < MinNum Then: Tmp = MaxNum: MaxNum = MinNum: MinNum = Tmp Randomize: NumeroAleatorio = CLng((MinNum - MaxNum + 1) * Rnd + MaxNum) End Function
Dulces Lunas!¡.