Sub Descomprimir
Destino = "C:\TuCarpeta\TuCarpeta"
Origen = "C:\TuCarpeta\TuCarpeta\ArchivoEquis.zip"
oAplica = CreateObject("Shell.Application")
oAplica.Namespace(Destino).CopyHere oAplica.Namespace(Origen).items
End Sub
oAplica = CreateObject("Shell.Application")
fornelasa escribió:Nunca he usado linux mint
mauricio escribió:Siempre es bueno mostrar la línea donde te da el error, ayuda a quien quiera ayudarte...
Supongo que te da error en la penultima línea, ¿es correcto?...
¿Que S.O. estas usando?... ¿realmente estas usando AOO 3.1 como dice tu firma?
Saludos
mauricio escribió:No damos soporte en estos foros para Office
'Listing 5.88: Extract all files in a zip file.
' Test usage for the following subs
'call unzipFileFromArchive("c:\test.zip", "test.txt", "c:\test.txt")
'call unzipArchive("c:\test.zip", "c:\")
Sub unzipFileFromArchive( _
strZipArchivePath As String, _
strSourceFileName As String, _
strDestinationFilePath As String)
Dim blnExists As Boolean
Dim args(0) As Variant
Dim objZipService As Variant
Dim objPackageStream As Variant
Dim objOutputStream As Variant
Dim objInputStream As Variant
Dim i As Integer
'==========================================================================
' Unzip a single file from an archive. You must know the exact name
' of the file inside the archive before this sub can dig it out.
'
' strZipArchivePath = full path (directory and filename)
' to the .zip archive file.
' strSourceFileName = the name of the file being dug from the .zip archive.
' strDestinationFilePath = full path (directory and filename) where
' the source file will be dumped.
'=========================================================================
' Create a handle to the zip service,
objZipService = createUnoService("com.sun.star.packages.Package")
args(0) = ConvertToURL(strZipArchivePath)
objZipService.initialize(args())
' Does the source file exist?
If Not objZipService.HasByHierarchicalName(strSourceFileName) Then Exit Sub
' Get the file input stream from the archive package stream.
objPackageStream = objZipService.GetByHierarchicalName(strSourceFileName)
objInputStream = objPackageStream.GetInputStream()
' Define the output.
objOutputStream = createUnoService("com.sun.star.ucb.SimpleFileAccess")
objOutputStream.WriteFile(ConvertToURL(strDestinationFilePath), _
objInputStream)
End Sub
Sub unzipArchive( _
strZipArchivePath As String, _
strDestinationFolder As String)
Dim args(0) As Variant
Dim objZipService As Variant
Dim objPackageStream As Variant
Dim objOutputStream As Variant
Dim objInputStream As Variant
Dim arrayNames() As Variant
Dim strNames As String
Dim i As Integer
'=========================================================================
' Unzip the an entire .zip archive to a destination directory.
'
' strZipArchivePath = full path to the .zip archive file.
' strDestinationFilePath = folder where the source files will be dumped.
'=========================================================================
' Create a handle to the zip service,
objZipService = createUnoService("com.sun.star.packages.Package")
args(0) = ConvertToURL(strZipArchivePath)
objZipService.initialize(args())
' Grab a package stream containing the entire archive.
objPackageStream = objZipService.GetByHierarchicalName("")
' Grab a listing of all files in the archive.
arrayNames = objPackageStream.getElementNames()
' Run through each file in the name array and pipe from archive
' to destination folder.
For i = LBound(arrayNames) To UBound(arrayNames)
strNames = strNames & arrayNames(i) & Chr(13)
' Read in and pump out one file at a time to the filesystem.
ObjInputStream = _
objZipService.GetByHierarchicalName(arrayNames(i)).GetInputStream()
objOutputStream = createUnoService("com.sun.star.ucb.SimpleFileAccess")
objOutputStream.WriteFile(ConvertToURL(strDestinationFolder & _
arrayNames(i)), objInputStream)
Next
MsgBox strNames
End Sub
196hongos escribió:mauricio escribió:Siempre es bueno mostrar la línea donde te da el error, ayuda a quien quiera ayudarte...
Supongo que te da error en la penultima línea, ¿es correcto?...
¿Que S.O. estas usando?... ¿realmente estas usando AOO 3.1 como dice tu firma?
Saludos
Que tal
asi es
oAplica = CreateObject("Shell.Application") esta linea es la del error.
estoy corriendolo en Office 2013
Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 3 invitados