Welcome to EMC Consulting Blogs Sign in | Join | Help

SSIS Junkie

Flickr Uploader

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:

  1. Prompt you for the location of the photos that you wish to upload
  2. Prompt you for an email address to send them to
  3. Send all photos in that folder with a ".jpg" suffix to that email address

Here's the code:

Sub SendEmailsToFlickr()


    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 + "\"

        End If


        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!


            End If

            photoFile = Dir()



    End If

End Sub

Very simple but very useful. Note that I've only tested it against Outlook 2007.



Published Sunday, February 25, 2007 7:19 PM by jamie.thomson


No Comments
New Comments to this post are disabled

This Blog


Powered by Community Server (Personal Edition), by Telligent Systems