Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1168to1172
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

zippen funzt net

zippen funzt net
marcl
hallo Excel-Spezis,
ich habe mir aus dem Internet einen Code kopiert und etwas verändert, da wir statt winziup 7 zip verwenden. Zudem möchte ich alle Datein des Ordners packen lassen.
Leider legt der mir nur ein leeres zip-Archiv an :-(
Bin für jede hilfe dankbar.
Sub Zippen()
' alle Dateien Zippen!
Dim sDatei As String
Dim sPfad As String
Dim zipName As String
sPfad = ActiveWorkbook.Path & "\"
sDatei = Dir(sPfad)
zipName = "test.zip"
Do While sDatei  ""
Shell "C:\Programme\7-Zip\7z.exe a " & Chr(34) & sPfad & zipName & Chr(34) & " " & Chr( _
34) & sDatei & Chr(34)
DoEvents
sDatei = Dir
Application.Wait Now + TimeSerial(0, 0, 5) ' warten, bis aktuelle Datei gezippt wurde
Loop
End Sub
Gruß
marcl

4
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Benutzer
Anzeige
ist ja 'ne TYPISCHE EXCEL-Frage :-( _oT
26.07.2010 14:07:54
NoNet
_oT
AW: zippen funzt net
26.07.2010 14:14:24
Anton
Hallo marcl,
ersetze
Shell "C:\Programme\7-Zip\7z.exe a " & Chr(34) & sPfad & zipName & Chr(34) & " " & Chr( _
34) & sDatei & Chr(34)
durch
Shell "C:\Programme\7-Zip\7z.exe a " & Chr(34) & sPfad & zipName & Chr(34) & " " & Chr( _
34) & sPfad & sDatei & Chr(34)
mfg Anton
zippen funzt jetzt
26.07.2010 15:13:51
marcl
Dummer Fehler,.....
Danke Anton
AW: zippen funzt net
26.07.2010 15:03:23
Tino
Hallo,
hab ich auch mal gebraucht.

'Zip Datei erstellen, Pfad Dos kompatibel********************************************************* 
Private Declare Function GetShortPathNameA Lib "kernel32" ( _
    ByVal lpszLongPath As String, _
    ByVal lpszShortPath As String, _
    ByVal cchBuffer As Long) As Long
Public Function ShortPath(ByRef Path As String) As String
  Dim n As Long
  ShortPath = Space$(256)
  n = GetShortPathNameA(Path, ShortPath, 255)
  ShortPath = Left$(ShortPath, n)
End Function


 Sub sb7z(Quelle$, Ziel$, ZipDateiName$, Optional sFilter$ = "*.*")
 Dim lstr7zPfad$
     'Pfad Dos kompatibel machen 
     Ziel = ShortPath(Ziel)
     Quelle = ShortPath(Quelle)
    
     'hier Verzeichnis eintragen, in dem 7Zip installiert ist 
     lstr7zPfad = "C:\Program Files\7-Zip\7z.exe a -tzip "
     
    
     'komprimiert nur Dateien 
     Shell lstr7zPfad & Ziel$ & ZipDateiName$ & " " & Quelle$ & sFilter
     
 End Sub


Sub Zippen()
Dim zipName As String, sQuelle As String, sZiel$
     
'wo die Dateien sind 
sQuelle = "C:\Mein Ordner\"
'wo das Zip File hin soll 
sZiel$ = IIf(Right$(ActiveWorkbook.Path, 1) = "\", ActiveWorkbook.Path, ActiveWorkbook.Path & "\")
'Zip Datei Name 
zipName = "MeinZipFile.zip"
     
'Parameter: Quelle, Ziel ,Zip-Name, [Filter = "*.*"] 
sb7z sQuelle, sZiel$, zipName, "*.xls"
 
End Sub

''weitere Infos ************************************************* 
'    a: Add files to archive 
'    b: Benchmark 
'    d: Delete files from archive 
'    e: Extract files from archive (without using directory names) 
'    l: List contents of archive 
'    t: Test integrity of archive 
'    u: Update files to archive 
'    x: eXtract files with full paths 
' 
'    -ai[r[-|0]]{@listfile|!wildcard}: Include archives 
'    -ax[r[-|0]]{@listfile|!wildcard}: eXclude archives 
'    -bd: Disable percentage indicator 
'    -i[r[-|0]]{@listfile|!wildcard}: Include filenames 
'    -m{Parameters}: set compression Method 
'    -o{Directory}: set Output directory 
'    -p{Password}: set Password 
'    -r[-|0]: Recurse subdirectories 
'    -scs{UTF-8 | WIN | DOS}: set charset for list files 
'    -sfx[{name}]: Create SFX archive 
'    -si[{name}]: read data from stdin 
'    -slt: show technical information for l (List) command 
'    -so: write data to stdout 
'    -ssc[-]: set sensitive case mode 
'    -ssw: compress shared files 
'    -t{Type}: Set type of archive 
'    -v{Size}[b|k|m|g]: Create volumes 
'    -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options 
'    -w[{path}]: assign Work directory. Empty path means a temporary directory 
'    -x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames 
'    -y: assume Yes on all queries 
Gruß Tino
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige