RE:nombre de archivo aleatorio
Alfredo: Lo que pedía es un temporal. Para obtenerlo podés utilizar el Api de esta manera:
Private Declare Function GetTempFileName Lib "kernel32" Alias "GetTempFileNameA" (ByVal lpszPath As String, ByVal lpPrefixString As String, ByVal wUnique As Long, ByVal lpTempFileName As String) As Long
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Public Function CrearTemporalEnUnPath(Optional ByVal strPref As String = "tmp", Optional ByRef strPath As String = "") As String
On Error Resume Next
Dim sBuffer As String, lng As Long
If Len(strPref) > 3 Then strPref = Left$(strPref, 3)
If strPath = "" Then strPath = ObtenerDirectorioTemporal
If strPath = "" Then GoTo NoTemporal 'NO DEBERÍA OCURRIR
sBuffer = String$(260, 0)
lng = GetTempFileName(strPath, strPref, 0, sBuffer)
CrearTemporalEnUnPath = IIf(lng <> 0, Left$(sBuffer, InStr(1, sBuffer, vbNullChar, vbTextCompare) - 1), "")
Exit Function
NoTemporal:
CrearTemporalEnUnPath = ""
End Function
Private Function ObtenerDirectorioTemporal() As String
Dim sBuffer As String, lng As Long
sBuffer = String$(260, 0)
lng = GetTempPath(260, sBuffer)
ObtenerDirectorioTemporal = IIf(lng >= 3, Left$(sBuffer, lng), "")
End Function
Private Sub Command1_Click()
MsgBox CrearTemporalEnUnPath
End Sub
Saludos Ruri