There may not be a way to do this. I have seen a few comments about VBS and zip not being compatible.
The current working VBS script is used to automate adding multiple attachments to an Outlook pre-addressed email and sending it out all at once. As written, the files can be selected from anywhere on the system by using Ctrl+click to select them and copy/paste or drag-drop to get them to the script which then does the rest. They all get attached regardless of where they are located once selected. I have never tried to add more than about 10 but I think the only limit is the file-size allowed by Outlook for an attachment.
Most file types can only be attached to an email by first adding them to a zip or other 'protective' shell and adding all the collected files to a single zip when they come from multiple locations is the problem. There seems to be no way to do this within the bounds of the VBS script and also no way to do it externally and then bring the results back into the script for completion.
If anyone can supply the missing "zip from anywhere" lines to the script it would be appreciated.
Somewhere after this line is where I presume it needs to be added.
.. Set objArgs = WScript.Arguments 'gets paths of selected files ..
Once the selected paths are set, those files need to be either zipped separately or added to a single larger zip before they are added to the email as attachments so Outlook will process it without choking up. This works as-is as long as all files are .txt or other allowed file types.
If there is another method of accomplishing the same goals in another language that would be OK as well. :thmbsup:
Note: Giving credit where credit is due: This code is originally from the 'Slipstick Outlook Forum' and named 'Joseph's Script Method'
It works extremely well for what it was originally written to do.
The current working VBS script is used to automate adding multiple attachments to an Outlook pre-addressed email and sending it out all at once. As written, the files can be selected from anywhere on the system by using Ctrl+click to select them and copy/paste or drag-drop to get them to the script which then does the rest. They all get attached regardless of where they are located once selected. I have never tried to add more than about 10 but I think the only limit is the file-size allowed by Outlook for an attachment.
Most file types can only be attached to an email by first adding them to a zip or other 'protective' shell and adding all the collected files to a single zip when they come from multiple locations is the problem. There seems to be no way to do this within the bounds of the VBS script and also no way to do it externally and then bring the results back into the script for completion.
If anyone can supply the missing "zip from anywhere" lines to the script it would be appreciated.

Somewhere after this line is where I presume it needs to be added.
.. Set objArgs = WScript.Arguments 'gets paths of selected files ..
Once the selected paths are set, those files need to be either zipped separately or added to a single larger zip before they are added to the email as attachments so Outlook will process it without choking up. This works as-is as long as all files are .txt or other allowed file types.
Code: ( vb)
Option Explicit
Dim objArgs, OutApp, oNameSpace, oInbox, oEmailItem, olMailItem
Dim a, oAttachments, subjectStr, olFormatHTML
olMailItem = 0
olFormatHTML = 2
Set objArgs = WScript.Arguments 'gets paths of selected files
Set OutApp = CreateObject("Outlook.Application") 'opens Outlook
Set oEmailItem = OutApp.CreateItem(olMailItem) 'opens new email
oEmailItem.To = " "
oEmailItem.cc = " "
For a = 0 to objArgs.Count - 1
Set oAttachments = oEmailItem.Attachments.Add(objArgs(a))
subjectStr = subjectStr & Right(objArgs(a),Len(objArgs(a))-(InStrRev(objArgs(a),"\"))) & ", " 'recreates the default Subject e.g. Emailing: file1.doc, file2.xls
Next
If subjectStr = "" then subjectStr = "No Subject "
oEmailItem.Subject = "" & Left(subjectStr, (Len(subjectStr)-2))
oEmailItem.BodyFormat = olFormatHTML
oEmailItem.Display
oEmailItem.SendIf there is another method of accomplishing the same goals in another language that would be OK as well. :thmbsup:
Note: Giving credit where credit is due: This code is originally from the 'Slipstick Outlook Forum' and named 'Joseph's Script Method'
It works extremely well for what it was originally written to do.




