B
bony_tony
Hi,
I'm new to VBA in outlook, although I have used it in Excel
I have read this thread;
http://groups.google.co.uk/group/mi...s+to+mail+merge&rnum=2&hl=en#0c7f64afc62bd773
I now have emails in my outbox, which I would like to attach files to.
However, I want to attach different Excel files to the different
messages, depending on which account reference (insterted from a merge
field) the message is relating to.
It looks like the merge fields have been replaced with text on the
emails, so I would somehow like to attach different files to the
emails based on the references found after "Account " on the first
line;
ie I would like to attach, say C:/REF12345.xls to the first message,
which would have the following in it's body
Account REF12345
Balance 13,024.88
Regards
A Company
The account reference is sometimes a different length of characters.
I'm assuming the following code would do this, but how do I apply my
reference to the value 'x'?
Sub AddAttachmentToSelectedMessages()
Dim objItem As Object
If ActiveExplorer.Selection.Count = 0 Then Exit Sub
For Each objItem In ActiveExplorer.Selection
objItem.Attachments.Add ("C:\" & x & ".xls")
objItem.Save
objItem.Send
Next
End Sub
Regards
Tony
I'm new to VBA in outlook, although I have used it in Excel
I have read this thread;
http://groups.google.co.uk/group/mi...s+to+mail+merge&rnum=2&hl=en#0c7f64afc62bd773
I now have emails in my outbox, which I would like to attach files to.
However, I want to attach different Excel files to the different
messages, depending on which account reference (insterted from a merge
field) the message is relating to.
It looks like the merge fields have been replaced with text on the
emails, so I would somehow like to attach different files to the
emails based on the references found after "Account " on the first
line;
ie I would like to attach, say C:/REF12345.xls to the first message,
which would have the following in it's body
Account REF12345
Balance 13,024.88
Regards
A Company
The account reference is sometimes a different length of characters.
I'm assuming the following code would do this, but how do I apply my
reference to the value 'x'?
Sub AddAttachmentToSelectedMessages()
Dim objItem As Object
If ActiveExplorer.Selection.Count = 0 Then Exit Sub
For Each objItem In ActiveExplorer.Selection
objItem.Attachments.Add ("C:\" & x & ".xls")
objItem.Save
objItem.Send
Next
End Sub
Regards
Tony