N
newboy18
Please help, I have 2 questions.
1/. I want my routine to send all .doc files in a folder
to a contact but how, the Attachments.Add will not allow
me to put "c:\docsemail\*.doc
2/. I want to start Outlook before running this sub
routine because it is part of a loop, it will be very slow
if I open Outlook for every email. I tried to move the
fist 2 lines to the main routine but the sub routine would
then fail at the "Set olMail = olApp.CreateItem
(olMailItem" line.
Sub EmailDoc()
Dim olApp As Outlook.Application
Set olApp = New Outlook.Application
Dim olMail As MailItem
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = "Smith, John"
.Subject = "New documents"
.Attachments.Add "c:\docsemail\test.txt"
.Attachments.Add "c:\docsemail\test2.txt"
.Send
End With
Set olMail = Nothing
olApp.Quit
Set olApp = Nothing
End Sub
1/. I want my routine to send all .doc files in a folder
to a contact but how, the Attachments.Add will not allow
me to put "c:\docsemail\*.doc
2/. I want to start Outlook before running this sub
routine because it is part of a loop, it will be very slow
if I open Outlook for every email. I tried to move the
fist 2 lines to the main routine but the sub routine would
then fail at the "Set olMail = olApp.CreateItem
(olMailItem" line.
Sub EmailDoc()
Dim olApp As Outlook.Application
Set olApp = New Outlook.Application
Dim olMail As MailItem
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = "Smith, John"
.Subject = "New documents"
.Attachments.Add "c:\docsemail\test.txt"
.Attachments.Add "c:\docsemail\test2.txt"
.Send
End With
Set olMail = Nothing
olApp.Quit
Set olApp = Nothing
End Sub