Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Open Outlook from Excel and send attachments

Hi,
Can someone send me a solutions for this or point me to a website where i
can find information for this.

I have an Excel 2002 sheet with two columns.
Column A is plain text, with an explanation about a certain PDF document.
Column B contains an hyperlink to a PDF document

In column C, i want to put, for example an 'X', after the documents which I
want to send with Outlook 2002.
Is it possible to write an Excel macro, which scans the column C looking
for the cells with an 'X' in it.
Then start Outlook and insert the documents, that the hyperlinks from
column B point to, as attachments.
Of course only the documents with an 'X' in column C.
The recipient and subject line doesn't have to be filled in.

Kind regards,

Bob









  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Open Outlook from Excel and send attachments

Bob,

Here is some code. I know that you said that the recipient and the subject
don't have to be filled in, but my example shows all of these. Do as you
will with that.

Sub SendMail()
Dim oOutlook As Object
Dim oMailItem As Object
Dim oRecipient As Object
Dim oNameSpace As Object
Dim cLastRow As Long
Dim i As Long

Set oOutlook = CreateObject("Outlook.Application")
Set oNameSpace = oOutlook.GetNameSpace("MAPI")
oNameSpace.Logon , , True

Set oMailItem = oOutlook.CreateItem(0)
With oMailItem
Set oRecipient = ")
oRecipient.Type = 1 '1 = To, use 2 for cc
'keep repeating these lines with
'your names, adding to the collection.
.Subject = "The extract has finished."
.Body = "This is an automatic email notification"
'add attachments
cLastRow = Cells(Rows.Count, "B").End(xlUp).Row
For i = 1 To cLastRow
If LCase(Cells(i, 3).Value) = "x" Then
.Attachments.Add Cells(i, 2).Hyperlinks(1).Address
End If
Next i
.Display
End With

End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Bob" wrote in message
...
Hi,
Can someone send me a solutions for this or point me to a website where i
can find information for this.

I have an Excel 2002 sheet with two columns.
Column A is plain text, with an explanation about a certain PDF document.
Column B contains an hyperlink to a PDF document

In column C, i want to put, for example an 'X', after the documents which

I
want to send with Outlook 2002.
Is it possible to write an Excel macro, which scans the column C looking
for the cells with an 'X' in it.
Then start Outlook and insert the documents, that the hyperlinks from
column B point to, as attachments.
Of course only the documents with an 'X' in column C.
The recipient and subject line doesn't have to be filled in.

Kind regards,

Bob











  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Open Outlook from Excel and send attachments

And if I am not asking too much can you please modify it so that it can be
used for MS Outlook Express?
TIA

"Bob Phillips" wrote in message
...
Bob,

Here is some code. I know that you said that the recipient and the subject
don't have to be filled in, but my example shows all of these. Do as you
will with that.

Sub SendMail()
Dim oOutlook As Object
Dim oMailItem As Object
Dim oRecipient As Object
Dim oNameSpace As Object
Dim cLastRow As Long
Dim i As Long

Set oOutlook = CreateObject("Outlook.Application")
Set oNameSpace = oOutlook.GetNameSpace("MAPI")
oNameSpace.Logon , , True

Set oMailItem = oOutlook.CreateItem(0)
With oMailItem
Set oRecipient = ")
oRecipient.Type = 1 '1 = To, use 2 for cc
'keep repeating these lines with
'your names, adding to the collection.
.Subject = "The extract has finished."
.Body = "This is an automatic email notification"
'add attachments
cLastRow = Cells(Rows.Count, "B").End(xlUp).Row
For i = 1 To cLastRow
If LCase(Cells(i, 3).Value) = "x" Then
.Attachments.Add Cells(i, 2).Hyperlinks(1).Address
End If
Next i
.Display
End With

End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Bob" wrote in message
...
Hi,
Can someone send me a solutions for this or point me to a website where

i
can find information for this.

I have an Excel 2002 sheet with two columns.
Column A is plain text, with an explanation about a certain PDF

document.
Column B contains an hyperlink to a PDF document

In column C, i want to put, for example an 'X', after the documents

which
I
want to send with Outlook 2002.
Is it possible to write an Excel macro, which scans the column C

looking
for the cells with an 'X' in it.
Then start Outlook and insert the documents, that the hyperlinks from
column B point to, as attachments.
Of course only the documents with an 'X' in column C.
The recipient and subject line doesn't have to be filled in.

Kind regards,

Bob













  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Open Outlook from Excel and send attachments

Sorry, but you are. OE doesn't expose an object model.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Martyn" wrote in message
...
And if I am not asking too much can you please modify it so that it can be
used for MS Outlook Express?
TIA



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Open Outlook from Excel and send attachments

Oh well...but anyway Thanks for the information Bob.

"Bob Phillips" wrote in message
...
Sorry, but you are. OE doesn't expose an object model.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Martyn" wrote in message
...
And if I am not asking too much can you please modify it so that it can

be
used for MS Outlook Express?
TIA







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot open Excel (.xls) attachments in Outlook childofthe1980s Excel Discussion (Misc queries) 1 May 29th 10 12:11 AM
Excel 2003 attachments open and show only empty cells when openedvia Outlook 2003? Rob Gordon Excel Discussion (Misc queries) 1 December 2nd 08 09:34 PM
Cannot Open Excel 2007 .XLSX Attachments in Outlook Email MC Excel Discussion (Misc queries) 0 October 10th 08 09:42 PM
how to send excel attachments which can be edited and sent back excel attachments Excel Discussion (Misc queries) 0 September 30th 05 03:38 PM
Excel attachments open in outlook 2002 as TMP files Kevin Dickson Excel Discussion (Misc queries) 1 July 16th 05 04:00 AM


All times are GMT +1. The time now is 06:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"