|
-
May 5th, 2009, 04:52 PM
#1
Re: VBA Code to Winzip external File
the shell object seems to do this quite well
vb Code:
p = "c:\test" z = p & "\mytest.zip" Open z For Output As 1 Print #1, Chr$(80) & Chr$(75) & Chr$(5) & Chr$(6) & String(18, 0) Close 1 Set sh = CreateObject("shell.application") sh.namespace(z).copyhere p Set sh = Nothing
copies all the files in folder test into new zip file in same folder
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
May 6th, 2009, 03:30 AM
#2
Thread Starter
Fanatic Member
Re: VBA Code to Winzip external File
Hi
I have copied your code as below and am still having problems
HTML Code:
Dim P As String
Dim Z As String
Dim ZipFileName As String
Dim MyAppID As String
P = filename
If Not Right(P, 4) = ".zip" Then
P = P & ".zip"
Else
P = P & ".CSV"
End If
Z = P
Open Z For Output As 1
Print #1, filename
Close Z
' MyAppID = Shell("C:\Program Files\WinZip\Winzip.exe", 1) ' Run
' AppActivate MyAppID ' Activate Microsoft
MyAppID = CreateObject("shell.application")
[COLOR="Red"] MyAppID = NameSpace(Z).copyhere & P[/COLOR]
Set MyAppID = Nothing
End Sub
I get an error on this line as it states 'Invalid qualifier'
Pls help!!
** HOLLY ** 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|