![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I found instructions for using mail merge in Word to send multiple emails
with attachments ("Mail Merge to E-mail with Attachments" by Doug Robbins). The macro generates an error and I have not been able to find a way around it. "Dim oOutlookApp As Outlook.Application" generates the following error: Compile Error: User-defined type not defined I don't know if and when I get around this there will be more errors or not... My goal is to send out 200 emails to 200 different addresses. The email text message and subject line are the same, but each email has a unique attachment. The attachments are all updated on a regular basis and are sent out via email after each update. Any help is greatly appreciated. |
Ads |
#2
|
|||
|
|||
![]()
It's a simple error with a simple fix: Use the Tools | References command to
add a reference to the Microsoft Outlook library and any other non-Word library that your code might nteed. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "KimS" wrote in message ... I found instructions for using mail merge in Word to send multiple emails with attachments ("Mail Merge to E-mail with Attachments" by Doug Robbins). The macro generates an error and I have not been able to find a way around it. "Dim oOutlookApp As Outlook.Application" generates the following error: Compile Error: User-defined type not defined I don't know if and when I get around this there will be more errors or not... My goal is to send out 200 emails to 200 different addresses. The email text message and subject line are the same, but each email has a unique attachment. The attachments are all updated on a regular basis and are sent out via email after each update. Any help is greatly appreciated. |
#3
|
|||
|
|||
![]()
Thanks for the quick response. I probably should have mentioned a couple of
other items: 1) I have MS Office 2003 and VBA version 6.5. 2) I am not well versed in VBA, though I have developed a few macros to make life easier. When I go to references, all I can do is either select or disselect objects. There is no option for modification. I do have the Microsoft Office 11.0 Object Library selected. Is there an easier way to link emails with unique files for a large emailing? "Sue Mosher [MVP]" wrote: It's a simple error with a simple fix: Use the Tools | References command to add a reference to the Microsoft Outlook library and any other non-Word library that your code might nteed. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "KimS" wrote in message ... I found instructions for using mail merge in Word to send multiple emails with attachments ("Mail Merge to E-mail with Attachments" by Doug Robbins). The macro generates an error and I have not been able to find a way around it. "Dim oOutlookApp As Outlook.Application" generates the following error: Compile Error: User-defined type not defined I don't know if and when I get around this there will be more errors or not... My goal is to send out 200 emails to 200 different addresses. The email text message and subject line are the same, but each email has a unique attachment. The attachments are all updated on a regular basis and are sent out via email after each update. Any help is greatly appreciated. |
#4
|
|||
|
|||
![]()
Who said anything about modification? Choose Tools | References, find the
Microsoft Outlook library and select it. If you don't want to write code, I'm sure the http://www.slipstick.com site can point you to tools you can download to do that kind of mailing. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "KimS" wrote in message ... Thanks for the quick response. I probably should have mentioned a couple of other items: 1) I have MS Office 2003 and VBA version 6.5. 2) I am not well versed in VBA, though I have developed a few macros to make life easier. When I go to references, all I can do is either select or disselect objects. There is no option for modification. I do have the Microsoft Office 11.0 Object Library selected. Is there an easier way to link emails with unique files for a large emailing? "Sue Mosher [MVP]" wrote: It's a simple error with a simple fix: Use the Tools | References command to add a reference to the Microsoft Outlook library and any other non-Word library that your code might nteed. "KimS" wrote in message ... I found instructions for using mail merge in Word to send multiple emails with attachments ("Mail Merge to E-mail with Attachments" by Doug Robbins). The macro generates an error and I have not been able to find a way around it. "Dim oOutlookApp As Outlook.Application" generates the following error: Compile Error: User-defined type not defined I don't know if and when I get around this there will be more errors or not... My goal is to send out 200 emails to 200 different addresses. The text message and subject line are the same, but each email has a unique attachment. The attachments are all updated on a regular basis and are sent out via email after each update. Any help is greatly appreciated. |
#5
|
|||
|
|||
![]()
Thank you Sue. I am not sure what is different now than before - the Outlook
objects were selected, but I started over this time. It appears to run through the paces, now I just need to figure out why no emails were received by my test subjects. Thank you for the help - it is really appreciated. I'll be tweaking my program now as needed. "Sue Mosher [MVP]" wrote: Who said anything about modification? Choose Tools | References, find the Microsoft Outlook library and select it. If you don't want to write code, I'm sure the http://www.slipstick.com site can point you to tools you can download to do that kind of mailing. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "KimS" wrote in message ... Thanks for the quick response. I probably should have mentioned a couple of other items: 1) I have MS Office 2003 and VBA version 6.5. 2) I am not well versed in VBA, though I have developed a few macros to make life easier. When I go to references, all I can do is either select or disselect objects. There is no option for modification. I do have the Microsoft Office 11.0 Object Library selected. Is there an easier way to link emails with unique files for a large emailing? "Sue Mosher [MVP]" wrote: It's a simple error with a simple fix: Use the Tools | References command to add a reference to the Microsoft Outlook library and any other non-Word library that your code might nteed. "KimS" wrote in message ... I found instructions for using mail merge in Word to send multiple emails with attachments ("Mail Merge to E-mail with Attachments" by Doug Robbins). The macro generates an error and I have not been able to find a way around it. "Dim oOutlookApp As Outlook.Application" generates the following error: Compile Error: User-defined type not defined I don't know if and when I get around this there will be more errors or not... My goal is to send out 200 emails to 200 different addresses. The text message and subject line are the same, but each email has a unique attachment. The attachments are all updated on a regular basis and are sent out via email after each update. Any help is greatly appreciated. |
#6
|
|||
|
|||
![]() "KimS" wrote: Thank you Sue. I am not sure what is different now than before - the Outlook objects were selected, but I started over this time. It appears to run through the paces, now I just need to figure out why no emails were received by my test subjects. Thank you for the help - it is really appreciated. I'll be tweaking my program now as needed. "Sue Mosher [MVP]" wrote: Who said anything about modification? Choose Tools | References, find the Microsoft Outlook library and select it. If you don't want to write code, I'm sure the http://www.slipstick.com site can point you to tools you can download to do that kind of mailing. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "KimS" wrote in message ... Thanks for the quick response. I probably should have mentioned a couple of other items: 1) I have MS Office 2003 and VBA version 6.5. 2) I am not well versed in VBA, though I have developed a few macros to make life easier. When I go to references, all I can do is either select or disselect objects. There is no option for modification. I do have the Microsoft Office 11.0 Object Library selected. Is there an easier way to link emails with unique files for a large emailing? "Sue Mosher [MVP]" wrote: It's a simple error with a simple fix: Use the Tools | References command to add a reference to the Microsoft Outlook library and any other non-Word library that your code might nteed. "KimS" wrote in message ... I found instructions for using mail merge in Word to send multiple emails with attachments ("Mail Merge to E-mail with Attachments" by Doug Robbins). The macro generates an error and I have not been able to find a way around it. "Dim oOutlookApp As Outlook.Application" generates the following error: Compile Error: User-defined type not defined I don't know if and when I get around this there will be more errors or not... My goal is to send out 200 emails to 200 different addresses. The text message and subject line are the same, but each email has a unique attachment. The attachments are all updated on a regular basis and are sent out via email after each update. Any help is greatly appreciated. |
#7
|
|||
|
|||
![]()
Sue,
i am facing the same problem. Microsoft Office 11.0 Object Library is already selected, but it doesn't work..... I am running the following code. Sub emailmergewithattachments() Dim Source As Document, Maillist As Document, TempDoc As Document Dim Datarange As Range Dim i As Long, j As Long Dim bStarted As Boolean Dim oOutlookApp As Outlook.Application Dim oItem As Outlook.MailItem Dim mysubject As String, message As String, title As String Set Source = ActiveDocument ' Check if Outlook is running. If it is not, start Outlook On Error Resume Next Set oOutlookApp = GetObject(, "Outlook.Application") If Err 0 Then Set oOutlookApp = CreateObject("Outlook.Application") bStarted = True End If ' Open the catalog mailmerge document With Dialogs(wdDialogFileOpen) .Show End With Set Maillist = ActiveDocument ' Show an input box asking the user for the subject to be inserted into the email messages message = "Enter the subject to be used for each email message." ' Set prompt. title = " Email Subject Input" ' Set title. ' Display message, title mysubject = InputBox(message, title) ' Iterate through the Sections of the Source document and the rows of the catalog mailmerge document, ' extracting the information to be included in each email. For j = 1 To Source.Sections.Count - 1 Set oItem = oOutlookApp.CreateItem(olMailItem) With oItem .Subject = mysubject .Body = Source.Sections(j).Range.Text Set Datarange = Maillist.Tables(1).Cell(j, 1).Range Datarange.End = Datarange.End - 1 .To = Datarange For i = 2 To Maillist.Tables(1).Columns.Count Set Datarange = Maillist.Tables(1).Cell(j, i).Range Datarange.End = Datarange.End - 1 .Attachments.Add Trim(Datarange.Text), olByValue, 1 Next i .Send End With Set oItem = Nothing Next j Maillist.Close wdDoNotSaveChanges ' Close Outlook if it was started by this macro. If bStarted Then oOutlookApp.Quit End If MsgBox Source.Sections.Count - 1 & " messages have been sent." 'Clean up Set oOutlookApp = Nothing End Sub "KimS" wrote: Thank you Sue. I am not sure what is different now than before - the Outlook objects were selected, but I started over this time. It appears to run through the paces, now I just need to figure out why no emails were received by my test subjects. Thank you for the help - it is really appreciated. I'll be tweaking my program now as needed. "Sue Mosher [MVP]" wrote: Who said anything about modification? Choose Tools | References, find the Microsoft Outlook library and select it. If you don't want to write code, I'm sure the http://www.slipstick.com site can point you to tools you can download to do that kind of mailing. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "KimS" wrote in message ... Thanks for the quick response. I probably should have mentioned a couple of other items: 1) I have MS Office 2003 and VBA version 6.5. 2) I am not well versed in VBA, though I have developed a few macros to make life easier. When I go to references, all I can do is either select or disselect objects. There is no option for modification. I do have the Microsoft Office 11.0 Object Library selected. Is there an easier way to link emails with unique files for a large emailing? "Sue Mosher [MVP]" wrote: It's a simple error with a simple fix: Use the Tools | References command to add a reference to the Microsoft Outlook library and any other non-Word library that your code might nteed. "KimS" wrote in message ... I found instructions for using mail merge in Word to send multiple emails with attachments ("Mail Merge to E-mail with Attachments" by Doug Robbins). The macro generates an error and I have not been able to find a way around it. "Dim oOutlookApp As Outlook.Application" generates the following error: Compile Error: User-defined type not defined I don't know if and when I get around this there will be more errors or not... My goal is to send out 200 emails to 200 different addresses. The text message and subject line are the same, but each email has a unique attachment. The attachments are all updated on a regular basis and are sent out via email after each update. Any help is greatly appreciated. |
#8
|
|||
|
|||
![]()
Did you follow my advice to Kim and add a reference to the Microsoft Outlook
11.0 library? If so, then you need to explain exactly what isn't working in your particular case. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Tirath" wrote in message ... Sue, i am facing the same problem. Microsoft Office 11.0 Object Library is already selected, but it doesn't work..... I am running the following code. Sub emailmergewithattachments() Dim Source As Document, Maillist As Document, TempDoc As Document Dim Datarange As Range Dim i As Long, j As Long Dim bStarted As Boolean Dim oOutlookApp As Outlook.Application Dim oItem As Outlook.MailItem Dim mysubject As String, message As String, title As String Set Source = ActiveDocument ' Check if Outlook is running. If it is not, start Outlook On Error Resume Next Set oOutlookApp = GetObject(, "Outlook.Application") If Err 0 Then Set oOutlookApp = CreateObject("Outlook.Application") bStarted = True End If ' Open the catalog mailmerge document With Dialogs(wdDialogFileOpen) .Show End With Set Maillist = ActiveDocument ' Show an input box asking the user for the subject to be inserted into the email messages message = "Enter the subject to be used for each email message." ' Set prompt. title = " Email Subject Input" ' Set title. ' Display message, title mysubject = InputBox(message, title) ' Iterate through the Sections of the Source document and the rows of the catalog mailmerge document, ' extracting the information to be included in each email. For j = 1 To Source.Sections.Count - 1 Set oItem = oOutlookApp.CreateItem(olMailItem) With oItem .Subject = mysubject .Body = Source.Sections(j).Range.Text Set Datarange = Maillist.Tables(1).Cell(j, 1).Range Datarange.End = Datarange.End - 1 .To = Datarange For i = 2 To Maillist.Tables(1).Columns.Count Set Datarange = Maillist.Tables(1).Cell(j, i).Range Datarange.End = Datarange.End - 1 .Attachments.Add Trim(Datarange.Text), olByValue, 1 Next i .Send End With Set oItem = Nothing Next j Maillist.Close wdDoNotSaveChanges ' Close Outlook if it was started by this macro. If bStarted Then oOutlookApp.Quit End If MsgBox Source.Sections.Count - 1 & " messages have been sent." 'Clean up Set oOutlookApp = Nothing End Sub "KimS" wrote: Thank you Sue. I am not sure what is different now than before - the Outlook objects were selected, but I started over this time. It appears to run through the paces, now I just need to figure out why no emails were received by my test subjects. Thank you for the help - it is really appreciated. I'll be tweaking my program now as needed. "Sue Mosher [MVP]" wrote: Who said anything about modification? Choose Tools | References, find the Microsoft Outlook library and select it. If you don't want to write code, I'm sure the http://www.slipstick.com site can point you to tools you can download to do that kind of mailing. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "KimS" wrote in message ... Thanks for the quick response. I probably should have mentioned a couple of other items: 1) I have MS Office 2003 and VBA version 6.5. 2) I am not well versed in VBA, though I have developed a few macros to make life easier. When I go to references, all I can do is either select or disselect objects. There is no option for modification. I do have the Microsoft Office 11.0 Object Library selected. Is there an easier way to link emails with unique files for a large emailing? "Sue Mosher [MVP]" wrote: It's a simple error with a simple fix: Use the Tools | References command to add a reference to the Microsoft Outlook library and any other non-Word library that your code might nteed. "KimS" wrote in message ... I found instructions for using mail merge in Word to send multiple emails with attachments ("Mail Merge to E-mail with Attachments" by Doug Robbins). The macro generates an error and I have not been able to find a way around it. "Dim oOutlookApp As Outlook.Application" generates the following error: Compile Error: User-defined type not defined I don't know if and when I get around this there will be more errors or not... My goal is to send out 200 emails to 200 different addresses. The text message and subject line are the same, but each email has a unique attachment. The attachments are all updated on a regular basis and are sent out via email after each update. Any help is greatly appreciated. |
#9
|
|||
|
|||
![]()
I also got a problem with this process.
My emails are not send. I run the macro, choose the document and get a note that says "0 messages sent". I hope somebody can help me. Sue Mosher [MVP] wrote: Did you follow my advice to Kim and add a reference to the Microsoft Outlook11. 16-sep-09 Did you follow my advice to Kim and add a reference to the Microsoft Outlook 11.0 library? If so, then you need to explain exactly what is not working in your particular case. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 Previous Posts In This Thread: On jueves, 10 de septiembre de 2009 17:50 KimS wrote: Mail Merge to email with attachments I found instructions for using mail merge in Word to send multiple emails with attachments ("Mail Merge to E-mail with Attachments" by Doug Robbins). The macro generates an error and I have not been able to find a way around it. "Dim oOutlookApp As Outlook.Application" generates the following error: Compile Error: User-defined type not defined I do not know if and when I get around this there will be more errors or not... My goal is to send out 200 emails to 200 different addresses. The email text message and subject line are the same, but each email has a unique attachment. The attachments are all updated on a regular basis and are sent out via email after each update. Any help is greatly appreciated. On jueves, 10 de septiembre de 2009 18:35 Sue Mosher [MVP] wrote: it is a simple error with a simple fix: Use the Tools | References command it is a simple error with a simple fix: Use the Tools | References command to add a reference to the Microsoft Outlook library and any other non-Word library that your code might nteed. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 On viernes, 11 de septiembre de 2009 11:16 KimS wrote: Thanks for the quick response. Thanks for the quick response. I probably should have mentioned a couple of other items: 1) I have MS Office 2003 and VBA version 6.5. 2) I am not well versed in VBA, though I have developed a few macros to make life easier. When I go to references, all I can do is either select or disselect objects. There is no option for modification. I do have the Microsoft Office 11.0 Object Library selected. Is there an easier way to link emails with unique files for a large emailing? "Sue Mosher [MVP]" wrote: On viernes, 11 de septiembre de 2009 15:03 Sue Mosher [MVP] wrote: Who said anything about modification? Who said anything about modification? Choose Tools | References, find the Microsoft Outlook library and select it. If you do not want to write code, I am sure the http://www.slipstick.com site can point you to tools you can download to do that kind of mailing. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 On viernes, 11 de septiembre de 2009 16:03 KimS wrote: Thank you Sue. Thank you Sue. I am not sure what is different now than before - the Outlook objects were selected, but I started over this time. It appears to run through the paces, now I just need to figure out why no emails were received by my test subjects. Thank you for the help - it is really appreciated. I will be tweaking my program now as needed. "Sue Mosher [MVP]" wrote: On mi?rcoles, 16 de septiembre de 2009 9:56 Tirath wrote: "KimS" wrote: "KimS" wrote: On mi?rcoles, 16 de septiembre de 2009 10:00 Tirath wrote: Sue,i am facing the same problem.Microsoft Office 11. Sue, i am facing the same problem. Microsoft Office 11.0 Object Library is already selected, but it does not work..... I am running the following code. Sub emailmergewithattachments() Dim Source As Document, Maillist As Document, TempDoc As Document Dim Datarange As Range Dim i As Long, j As Long Dim bStarted As Boolean Dim oOutlookApp As Outlook.Application Dim oItem As Outlook.MailItem Dim mysubject As String, message As String, title As String Set Source = ActiveDocument ' Check if Outlook is running. If it is not, start Outlook On Error Resume Next Set oOutlookApp = GetObject(, "Outlook.Application") If Err 0 Then Set oOutlookApp = CreateObject("Outlook.Application") bStarted = True End If ' Open the catalog mailmerge document With Dialogs(wdDialogFileOpen) ..Show End With Set Maillist = ActiveDocument ' Show an input box asking the user for the subject to be inserted into the email messages message = "Enter the subject to be used for each email message." ' Set prompt. title = " Email Subject Input" ' Set title. ' Display message, title mysubject = InputBox(message, title) ' Iterate through the Sections of the Source document and the rows of the catalog mailmerge document, ' extracting the information to be included in each email. For j = 1 To Source.Sections.Count - 1 Set oItem = oOutlookApp.CreateItem(olMailItem) With oItem ..Subject = mysubject ..Body = Source.Sections(j).Range.Text Set Datarange = Maillist.Tables(1).Cell(j, 1).Range Datarange.End = Datarange.End - 1 ..To = Datarange For i = 2 To Maillist.Tables(1).Columns.Count Set Datarange = Maillist.Tables(1).Cell(j, i).Range Datarange.End = Datarange.End - 1 ..Attachments.Add Trim(Datarange.Text), olByValue, 1 Next i ..Send End With Set oItem = Nothing Next j Maillist.Close wdDoNotSaveChanges ' Close Outlook if it was started by this macro. If bStarted Then oOutlookApp.Quit End If MsgBox Source.Sections.Count - 1 & " messages have been sent." 'Clean up Set oOutlookApp = Nothing End Sub "KimS" wrote: On mi?rcoles, 16 de septiembre de 2009 10:14 Sue Mosher [MVP] wrote: Did you follow my advice to Kim and add a reference to the Microsoft Outlook11. Did you follow my advice to Kim and add a reference to the Microsoft Outlook 11.0 library? If so, then you need to explain exactly what is not working in your particular case. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 EggHeadCafe - Software Developer Portal of Choice Team Development Concepts with Visual Studio.NET http://www.eggheadcafe.com/tutorials...-concepts.aspx |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Merge contact lists and email with mail merge | DiHo | Outlook - Using Contacts | 1 | January 26th 09 09:07 PM |
Sending attachments with mail merge emails in Word/Outlook 2003 | Kelly | Outlook - Using Contacts | 2 | January 8th 09 04:36 PM |
Mail merge with attachments? Office 07 | Boppy | Outlook - General Queries | 2 | November 26th 07 04:13 AM |
Mail Merge - Can I cc the email? | Joey | Outlook - General Queries | 2 | September 8th 06 03:13 PM |
Can I send attachments when doing an email merge? | PVakerling | Outlook - General Queries | 1 | June 29th 06 10:50 PM |