Nico
Tue May 04 07:36:57 CDT 2004
Thanks a lot. I think this is it :)
o
"dk1983" <anonymous@discussions.microsoft.com> wrote in message
news:097596D3-3021-44E5-AFEA-A173B9B7BC63@microsoft.com...
>
> Go to
http://winzip.com/downcl.htm and check that out..
>
> Then you can use this code that does exactly what you want to..
> <--CODE BEGINS-->
> Set Shell = CreateObject("WScript.Shell")
> set FS = CreateObject("Scripting.FileSystemObject")
>
> FS.CreateTextFile("zip.cmd")
> Set filezip = FS.OpenTextfile("zip.cmd", ForAppending)
> filezip.WriteLine "f:"
> filezip.WriteLine "cd some folder"
> filezip.WriteLine "cd some subfolder"
> filezip.WriteLine "Del OldZipFile.zip"
> filezip.WriteLine "wzzip NewZipFileNameHere.zip FilesToADD.txt" <-- You
can use wildcards here
> filezip.Close
> '==============================================
> Shell.Run "zip.cmd",2,True
> Wscript.Echo "Done Zipping Up Files..." _
> & vbCRLF & "Starting To Email Out The Reports..."
> '==============================================
> On Error Resume Next
> set FS = CreateObject("Scripting.FileSystemObject")
> Set WSHShell = WScript.CreateObject("WScript.Shell")
> Set objOutlook = Wscript.CreateObject("Outlook.Application")
> strTitle="Send Outlook Email"
> '====Set a reference to the MailItem object
> Set objMsg = objOutlook.CreateItem(0)
> if err.number<>0 then
> wscript.echo "("&err.number&") "& err.description
> wscript.echo "Error creating Outlook object."
> wscript.quit(1)
> end if
> '==== Recipients
> strSendTo=objMsg.Recipients.Add ("someone@somewhere.com")
> 'strSendTo=objMsg.Recipients.Add ("someone@somewhere.com") 'Uncomment this
out if you want to send to multiple people
> '===== Add subject
> objMsg.Subject = "Reports for " & Date
> '===== Attach files
> objMsg.Attachments.Add("FullPath&FileNameHere")
> 'objMsg.Attachments.Add("FullPath&FileNameHere") 'Uncomment this out if
you want to attach mutiple files
> '====Sends email
> objMsg.Send
> '===Clean UP
> Set objOutlook = Nothing
> Set objMsg = Nothing
> <--CODE ENDS-->