I use Flickr alot to host all of my digital photos but I tend to have a hard time uploading them all, for some reason the Flickr Uploader can be a bit tempremental, particularly for large files. Thankfully Flickr also allow you to upload emails by emailing them, as attachments, to an assigned email address.
I wanted to write a tool that would upload all of my photos via this email address - just point it at a folder containing the photos and off it goes. I don't admit to being much of a developer so, due to my email client being Microsoft Outlook 2007 I thought the quickest and easiest way was to resort to old skool - VBA.
The following VBA macro will:
- Prompt you for the location of the photos that you wish to upload
- Prompt you for an email address to send them to
- Send all photos in that folder with a ".jpg" suffix to that email address
Here's the code:
Dim flickrAddress, folderToIterate As String
flickrAddress = InputBox("What email address do you want to send the photos to?", "Flickr Sender")
'Check email address validity
If InStr(1, flickrAddress, "@", vbTextCompare) = 0 Then
Dim ret As Object
ret = MsgBox("That is not a valid email address", vbOKOnly, "Flickr Sender")
folderToIterate = InputBox("Which folder contains all your photos?", "Flickr Sender")
'Check folder validity
If (Right(folderToIterate, 1) <> "\") Then
folderToIterate = folderToIterate + "\"
Dim photoFile As String
photoFile = Dir(folderToIterate, vbNormal)
Do While photoFile > ""
If LCase(Right(photoFile, 4)) = ".jpg" Then
'Configure the email
Dim email As MailItem
email = Application.CreateItem(olMailItem)
email.Subject = photoFile
email.Attachments.Add(folderToIterate + photoFile)
'Send the thing!
photoFile = Dir()
Very simple but very useful. Note that I've only tested it against Outlook 2007.