View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Want to Unzip files automatically

Hi Hari

http://www.rondebruin.nl/zip.htm
http://www.rondebruin.nl/unzip.htm#zip

From my site

The examples are only working If you use WinZip as your Zip program.
(Note: you must have a registered copy of WinZip)


As far as i know you can't run the Windows Xp zip program with code

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Hari" wrote in message ...
Hi,

I want to open some Zipped files through VBA (Excel) and then unzip them to
my target folder.
I got ready made stuff for me from Ron de Bruin's site
http://www.rondebruin.nl/unzip.htm#zip

But the problem is ....I have Windows XP and probably zipping is integrated
in to XP so for me
the statement "Pathwinzip = .." doesnt make sense. Also, within ShellStr it
did not make sense to me
to include pathname so, I modified the above code to the following...

Sub UnZip_ZipFile_1change()
Dim PathWinZip As String, FileNameZip As String
Dim ShellStr As String, FolderName As String

FileNameZip = "C:\Documents and Settings\abc\Desktop\DEV1_1022.zip"
FolderName = "C:\Documents and Settings\abc\Desktop\Unzipped data"

ShellStr = FileNameZip & Chr(34) _
& " " & Chr(34) & FolderName & Chr(34)
ShellAndWait ShellStr, vbHide
MsgBox "Look in " & FolderName & " for extracted files"
End Sub

But by doing that, VBA displays an error "Run-time error '53': File not
found" when it is processing "hProg = shell(PathName, WindowState)" within
Public Sub ShellAndWait .

(I didnt want to make the mail very big, so didnt paste Ron's actual code
here. If that is not a correct practice please tell me so and in future I
would paste the 'source-code' as well)

--
Thanks a lot,
Hari
India