A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Loop Attachment (once again)



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 28th 09, 12:31 AM posted to microsoft.public.outlook.program_vba
Dan
external usenet poster
 
Posts: 166
Default Loop Attachment (once again)

Hello people,
Here is a question: I need a macro that will be able to create a new message
and add an attachment per each new message and loop through a folder. The
reason for that is attachments should be of specific size not less or more of
500 KB each and therefore I can't add all of them into one email. And there
will about 50 messages, maybe more later. It will be continuing (at least it
looks like so for now). Anyone can help me with it? Thanks in advance
Dan
PS: At least, if you know any recommendations of where I can find similar
written code.
Ads
  #2  
Old May 28th 09, 02:30 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Loop Attachment (once again)

What version of Outlook. This is supposed to run as an Outlook VBA macro?

What do you mean by "loop through a folder"? What kind of folder, loop and
do what?

I don't know what 50 messages has to do with it, what is different about
each of those 50 messages? How do you want the code to handle those 50
messages, is it different for each one? How?

Is this macro supposed to run on demand or automatically?

There are lots of Outlook code samples at www.outlookcode.com, but no one
can be much more specific until you clearly explain what you need and what
you want to accomplish. That's most likely why no one has been answering
your posts, the requirements aren't clearly explained.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Dan" wrote in message
...
Hello people,
Here is a question: I need a macro that will be able to create a new
message
and add an attachment per each new message and loop through a folder. The
reason for that is attachments should be of specific size not less or more
of
500 KB each and therefore I can't add all of them into one email. And
there
will about 50 messages, maybe more later. It will be continuing (at least
it
looks like so for now). Anyone can help me with it? Thanks in advance
Dan
PS: At least, if you know any recommendations of where I can find similar
written code.


  #3  
Old May 28th 09, 03:00 PM posted to microsoft.public.outlook.program_vba
Dan
external usenet poster
 
Posts: 166
Default Loop Attachment (once again)

Hi Ken,
Sorry about the confusion - I am using MS Outlook 2007. The issue about the
folder and 50 messages, I need to send some files to friend of mine which is
about 50 MB but provider doesn't let emails through that have attachments
that are more 500 KB, therefore I had split them. Now I have 100 files and I
will have to create an email for each file. Like 1st email and attache 1st
file, and then create 2nd email and attach 2nd file and so one until I am
done attaching all 100 files (that is why I called it loop - do until finish
all files in a folder). It is a bit tiresome and that is the reason I had
asked for help! Do you think there is anything available at Outlook
Programming-VBA community?

With best regards
Dan
  #4  
Old May 28th 09, 06:59 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Loop Attachment (once again)

I don't think there's anything specific for something like that, if it was
me and I didn't own a Web site I'd just use one of those public sites where
you can post files for FTP downloads, or something like that. I'd also be
looking for a different ISP, that limitation is absurd.

You can use something like FileSystemObject to get at the folder and all
files in it. Then loop and iterate each file and add it as an attachment to
a mail item. Something like this I suppose, which would require a VBA
project reference for the MS Scripting Runtime (scrrun.dll):

Dim FSO As Scripting.FileSystemObject
Dim tFile As Scripting.File
Dim oFolder As Scripting.Folder
Dim sPath As String
Dim sTemp As String

Set FSO = CreateObject("Scripting.FileSystemObject")
sPath = "C:\"
Set oFolder = FSO.GetFolder(sPath)
For Each tFile In oFolder.Files
sTemp = sPath & tFile.name

Set oMail = Application.CreateItem(olMailItem)

oMail.Subject = "More files"

Set oRecip = ")
oRecip.Resolve

oMail.Attachments.Add(sTemp)

oMail.Send
Next


--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Dan" wrote in message
news
Hi Ken,
Sorry about the confusion - I am using MS Outlook 2007. The issue about
the
folder and 50 messages, I need to send some files to friend of mine which
is
about 50 MB but provider doesn't let emails through that have attachments
that are more 500 KB, therefore I had split them. Now I have 100 files and
I
will have to create an email for each file. Like 1st email and attache 1st
file, and then create 2nd email and attach 2nd file and so one until I am
done attaching all 100 files (that is why I called it loop - do until
finish
all files in a folder). It is a bit tiresome and that is the reason I had
asked for help! Do you think there is anything available at Outlook
Programming-VBA community?

With best regards
Dan


  #5  
Old May 28th 09, 08:54 PM posted to microsoft.public.outlook.program_vba
Dan
external usenet poster
 
Posts: 166
Default Loop Attachment (once again)

Thanks again, Ken! It worked just perfect. Unfortunately changing ISP would
not help, as the attachment size limitation issue is not in US, the ISP is in
Central Asia, the recipient's provider. And there are not many providers
available either in there. And FTP public sites are not available either.
Anyway, thanks again.

All the best
Dan.
  #6  
Old December 28th 09, 03:23 PM posted to microsoft.public.outlook.program_vba
Curt
external usenet poster
 
Posts: 19
Default signature & picture

Not familar with outlook VBA have used excel & word. Would like to build a
macro that will insert a signature & a picture on one stroke. I use a two
step method now only on forward or reply messages. If i create a new message
it will not allow me to insert signature & picture. Useing 2000 & xp
Any code I can work with will be appreciated.
Thanks

"Ken Slovak - [MVP - Outlook]" wrote:

I don't think there's anything specific for something like that, if it was
me and I didn't own a Web site I'd just use one of those public sites where
you can post files for FTP downloads, or something like that. I'd also be
looking for a different ISP, that limitation is absurd.

You can use something like FileSystemObject to get at the folder and all
files in it. Then loop and iterate each file and add it as an attachment to
a mail item. Something like this I suppose, which would require a VBA
project reference for the MS Scripting Runtime (scrrun.dll):

Dim FSO As Scripting.FileSystemObject
Dim tFile As Scripting.File
Dim oFolder As Scripting.Folder
Dim sPath As String
Dim sTemp As String

Set FSO = CreateObject("Scripting.FileSystemObject")
sPath = "C:\"
Set oFolder = FSO.GetFolder(sPath)
For Each tFile In oFolder.Files
sTemp = sPath & tFile.name

Set oMail = Application.CreateItem(olMailItem)

oMail.Subject = "More files"

Set oRecip = ")
oRecip.Resolve

oMail.Attachments.Add(sTemp)

oMail.Send
Next


--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Dan" wrote in message
news
Hi Ken,
Sorry about the confusion - I am using MS Outlook 2007. The issue about
the
folder and 50 messages, I need to send some files to friend of mine which
is
about 50 MB but provider doesn't let emails through that have attachments
that are more 500 KB, therefore I had split them. Now I have 100 files and
I
will have to create an email for each file. Like 1st email and attache 1st
file, and then create 2nd email and attach 2nd file and so one until I am
done attaching all 100 files (that is why I called it loop - do until
finish
all files in a folder). It is a bit tiresome and that is the reason I had
asked for help! Do you think there is anything available at Outlook
Programming-VBA community?

With best regards
Dan



  #7  
Old December 28th 09, 03:49 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default signature & picture

You need to read any replies to you posts and not just keep posting the same
things.

This thread you latched onto has nothing at all to do with your question,
which was already answered in one of your original threads.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Curt" wrote in message
...
Not familar with outlook VBA have used excel & word. Would like to build a
macro that will insert a signature & a picture on one stroke. I use a two
step method now only on forward or reply messages. If i create a new
message
it will not allow me to insert signature & picture. Useing 2000 & xp
Any code I can work with will be appreciated.
Thanks

"Ken Slovak - [MVP - Outlook]" wrote:

I don't think there's anything specific for something like that, if it
was
me and I didn't own a Web site I'd just use one of those public sites
where
you can post files for FTP downloads, or something like that. I'd also be
looking for a different ISP, that limitation is absurd.

You can use something like FileSystemObject to get at the folder and all
files in it. Then loop and iterate each file and add it as an attachment
to
a mail item. Something like this I suppose, which would require a VBA
project reference for the MS Scripting Runtime (scrrun.dll):

Dim FSO As Scripting.FileSystemObject
Dim tFile As Scripting.File
Dim oFolder As Scripting.Folder
Dim sPath As String
Dim sTemp As String

Set FSO = CreateObject("Scripting.FileSystemObject")
sPath = "C:\"
Set oFolder = FSO.GetFolder(sPath)
For Each tFile In oFolder.Files
sTemp = sPath & tFile.name

Set oMail = Application.CreateItem(olMailItem)

oMail.Subject = "More files"

Set oRecip = ")
oRecip.Resolve

oMail.Attachments.Add(sTemp)

oMail.Send
Next


--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Dan" wrote in message
news
Hi Ken,
Sorry about the confusion - I am using MS Outlook 2007. The issue about
the
folder and 50 messages, I need to send some files to friend of mine
which
is
about 50 MB but provider doesn't let emails through that have
attachments
that are more 500 KB, therefore I had split them. Now I have 100 files
and
I
will have to create an email for each file. Like 1st email and attache
1st
file, and then create 2nd email and attach 2nd file and so one until I
am
done attaching all 100 files (that is why I called it loop - do until
finish
all files in a folder). It is a bit tiresome and that is the reason I
had
asked for help! Do you think there is anything available at Outlook
Programming-VBA community?

With best regards
Dan




 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Loop Attachment Dan Outlook and VBA 0 May 27th 09 03:18 AM
Trying to loop through RDOFolders Recursively Bill Benson Outlook and VBA 3 September 24th 08 12:34 AM
Loop through future appointments Daniel Outlook and VBA 2 July 5th 07 01:30 PM
CDO Loop problem - Fix could be useful for many people. [email protected] Outlook and VBA 1 March 30th 07 04:52 PM
Reverse loop? yonina Outlook and VBA 2 February 2nd 06 09:10 AM


All times are GMT +1. The time now is 03:02 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.