Unzipping FIles - Help Please

G

Guest

I am trying to get access to unzip files and allow me to import the text
document within.

I have read Douglas Steeles response on the 01/10/2006 and
I have tried Eduardos code however cant get it to work ... I have imported
the class module however cant seem to call the different sub routines ...

CreateZip("C:\MyDocument")
Public Sub ExtractFile( "C:\Testzip.zip","C:\ZipFIles\")


Is there anything obvious that I am missing
 
D

Douglas J. Steele

Well, I did say that I hadn't tried using Eduardo's code... <g>

I tried just now, but because I have available on this machine is Access 97,
I was unable to make it work (there are some constructs, such as Enums, that
aren't supported in Access 97). However, looking closer at the code, it's
entirely possible it won't work in VBA: I'm not sure VBA will accept the
"Private m_oStorage As IStorage" declaration.

Have you worked with classes before? It's not as straight-forward as calling
the functions.

If you named the class ZipClass, I believe you need code like:

Dim MyClass As ZipClass

Set MyClass = New ZipClass
MyClass.CreateZip "C:\Folder\File.zip"
MyClass.CompressFile "C:\Some Folder\Some File.txt"
MyClass.CompressFile "C:\Some Folder\Some Other File.txt"
MyClass.CloseZip
Set MyClass = Nothing

That should create a zip file named C:\Folder\File.zip that contains two
files C:\Some Folder\Some File.txt and C:\Some Folder\Some Other File.txt
 
G

Guest

Doug

Again you are right on a number of counts. In have not used class objects
before and the code provided does not work and I am using access 2003.

Compile Error
User Defined type not defined

at the line
Private m_oStorage As IStorage

Any ideas or pointers would be gratefully appreciated as I really need this
to work

--
Many Thanks Again

Alan


Douglas J. Steele said:
Well, I did say that I hadn't tried using Eduardo's code... <g>

I tried just now, but because I have available on this machine is Access 97,
I was unable to make it work (there are some constructs, such as Enums, that
aren't supported in Access 97). However, looking closer at the code, it's
entirely possible it won't work in VBA: I'm not sure VBA will accept the
"Private m_oStorage As IStorage" declaration.

Have you worked with classes before? It's not as straight-forward as calling
the functions.

If you named the class ZipClass, I believe you need code like:

Dim MyClass As ZipClass

Set MyClass = New ZipClass
MyClass.CreateZip "C:\Folder\File.zip"
MyClass.CompressFile "C:\Some Folder\Some File.txt"
MyClass.CompressFile "C:\Some Folder\Some Other File.txt"
MyClass.CloseZip
Set MyClass = Nothing

That should create a zip file named C:\Folder\File.zip that contains two
files C:\Some Folder\Some File.txt and C:\Some Folder\Some Other File.txt
 
D

Douglas J. Steele

Check what Tony Toews has at http://www.granite.ab.ca/access/compression.htm

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Alan said:
Doug

Again you are right on a number of counts. In have not used class objects
before and the code provided does not work and I am using access 2003.

Compile Error
User Defined type not defined

at the line
Private m_oStorage As IStorage

Any ideas or pointers would be gratefully appreciated as I really need
this
to work
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top