PDA

View Full Version : Emailing multiple attachments from Excel



starsky
02-18-2010, 10:11 AM
Hello,

The code below is part of a set of procedures that allow me to quickly email workbooks from within Excel. At the moment it works perfectly when sending one attachment, i.e. an Outlook message is opened with relevant fields completed. I want to be able to send more than 1 file as attachments. The code below will place the filepath of the file to attach into A6, then the SendMessage function from CodeForExcelandOutlook uses that and information in other cells to populate the email.

The code below successfully places the filepaths of more than one file into A6, but this does not translate into the Outlook message. Any ideas? I've tried seperating two filepaths with ; and &, to no avail.

Sub Choosefile()

Dim fn
Dim Answer As String
Dim Qtn As String

fn = Application.GetOpenFilename

Range("A6") = fn

Qtn = "Would you like to choose another file?"

Answer = MsgBox(Qtn, vbQuestion + vbYesNo, "?")

If Answer = vbNo Then
Exit Sub
Else
fn = Application.GetOpenFilename
End If

Range("A6") = Range("A6").Value & " & " & fn

End Sub

Thanks.

GTO
02-20-2010, 07:54 PM
...The code below will place the filepath of the file to attach into A6, then the SendMessage function from CodeForExcelandOutlook uses that and information in other cells to populate the email....

I think that if we were to have a shot at helping, we would need to see how SendMessage() was using the filepath from A6...

SamT
02-21-2010, 12:40 PM
You already tried semicolon+space as sperator?


Range("A6").Value = Range("A6").Value & "; " & fn


SamT