me dice error en tiempo de ejecucion 52 nombre o numero de archivo:
Private Sub juntar_Click()
Dim Ap1 As String
Dim file As String
Dim Ext1 As String
Dim filed As String
Dim i As Integer
Dim nombre As String
If lista.ListCount < 2 Then
MsgBox "Seleciona más de un archivo", vbCritical, "Error"
Exit Sub
End If
ga.FileName = "Joiner"
ga.DialogTitle = "Guardar Como..."
ga.DefaultExt = "*.exe"
ga.ShowSave
FileCopy App.Path & "\stubb.dll", ga.FileName
For i = 0 To lista.ListCount - 1
Open lista.List(i) For Binary As #1
file = Space(LOF(1))
Get #1, , file
Close #1
filed = StrReverse(file)
file = ""
Text1.Text = lista.List(i)
Ext1 = Ext(Text1.Text)
nombre = Nam(Text1.Text)
Ap1 = Ap1 & "/separador/" & filed & "/separador/" & Ext1 & "/separador/" & nombre
Next
Open ga.FileName For Binary As #1
Seek (1), LOF(1) + 1
Put #1, , Ap1
Close #1
MsgBox "Archivos Juntados", vbOKOnly, "AVISO"
End Sub
a mi parecer lo tengo todo bien y no puedo juntar los dos archivos
Mira aca te de un ejemplo super simple para empaquetar archivos, lo arme en 5 min asi que no pretendas nada super, pero como base esta bien.
Option Explicit
Private Sub Form_Load()
Dim pbg As New PropertyBag
SaveFile App.Path & "\text1.txt", StrConv("Test File 1", vbFromUnicode)
SaveFile App.Path & "\text2.txt", StrConv("Test File 2", vbFromUnicode)
pbg.WriteProperty "File1", GetFile(App.Path & "\text1.txt")
pbg.WriteProperty "File2", GetFile(App.Path & "\text2.txt")
Kill App.Path & "\text1.txt"
Kill App.Path & "\text2.txt"
SaveFile App.Path & "\Pack.dat", pbg.Contents
Set pbg = Nothing
Set pbg = New PropertyBag
pbg.Contents = GetFile(App.Path & "\Pack.dat")
SaveFile App.Path & "\text1.txt", pbg.ReadProperty("File1")
SaveFile App.Path & "\text2.txt", pbg.ReadProperty("File2")
Kill App.Path & "\Pack.dat"
End Sub
Private Function GetFile(sFile As String) As Byte()
Dim iFile As Long
iFile = FreeFile
Open sFile For Binary Access Read As iFile
ReDim GetFile(LOF(iFile) - 1)
Get iFile, , GetFile
Close iFile
End Function
Private Sub SaveFile(sFile As String, bvData() As Byte)
Dim iFile As Long
iFile = FreeFile
Open sFile For Binary Access Write As iFile
Put iFile, , bvData
Close iFile
End Sub