![]() |
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
|
|||
|
|||
![]()
Hello,
I'd like to script sending a message with an attachment. I've found how to do this when you know the attachment's name. But I need to script adding an attachment when I don't know it's name. The file I want to attach will always be located in C:\Reports and will always be a PDF, but the name will change every day. I tried ATT = "C:\Reports\*.pdf" but that didn't work. I copied this script from a site and modified it for my needs, I really don't know anything about scripting. Any help would be appreciated. Thank you. RCP = " MSG = "Test message" SUBJ = "Test subject" ATT = "C:\Reports\Attachment.pdf" Set Outlook = CreateObject("Outlook.Application") Set MAPI = Outlook.GetNameSpace("MAPI") Set NewMail = Outlook.CreateItem(0) NewMail.Subject = SUBJ NewMail.Body = MSG NewMail.Recipients.Add RCP NewMail.Attachments.Add ATT NewMail.Send |
Ads |
#2
|
|||
|
|||
![]()
Outlook doesn't know anything about files. You either have to know the name or use FileSystemObject or other methods to determine the file name. See http://msdn.microsoft.com/library/en...jsfsotutor.asp for an FSO reference.
-- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "ac2006" wrote in message ... Hello, I'd like to script sending a message with an attachment. I've found how to do this when you know the attachment's name. But I need to script adding an attachment when I don't know it's name. The file I want to attach will always be located in C:\Reports and will always be a PDF, but the name will change every day. I tried ATT = "C:\Reports\*.pdf" but that didn't work. I copied this script from a site and modified it for my needs, I really don't know anything about scripting. Any help would be appreciated. Thank you. RCP = " MSG = "Test message" SUBJ = "Test subject" ATT = "C:\Reports\Attachment.pdf" Set Outlook = CreateObject("Outlook.Application") Set MAPI = Outlook.GetNameSpace("MAPI") Set NewMail = Outlook.CreateItem(0) NewMail.Subject = SUBJ NewMail.Body = MSG NewMail.Recipients.Add RCP NewMail.Attachments.Add ATT NewMail.Send |
#3
|
|||
|
|||
![]()
Hi Sue,
Thank you for your response. However, the link you provided takes me to two redirect pages and at the final page it crashes out both I.E. and Firefox. Do you happen to have another link with the same info? --Ali "Sue Mosher [MVP-Outlook]" wrote: Outlook doesn't know anything about files. You either have to know the name or use FileSystemObject or other methods to determine the file name. See http://msdn.microsoft.com/library/en...jsfsotutor.asp for an FSO reference. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "ac2006" wrote in message ... Hello, I'd like to script sending a message with an attachment. I've found how to do this when you know the attachment's name. But I need to script adding an attachment when I don't know it's name. The file I want to attach will always be located in C:\Reports and will always be a PDF, but the name will change every day. I tried ATT = "C:\Reports\*.pdf" but that didn't work. I copied this script from a site and modified it for my needs, I really don't know anything about scripting. Any help would be appreciated. Thank you. RCP = " MSG = "Test message" SUBJ = "Test subject" ATT = "C:\Reports\Attachment.pdf" Set Outlook = CreateObject("Outlook.Application") Set MAPI = Outlook.GetNameSpace("MAPI") Set NewMail = Outlook.CreateItem(0) NewMail.Subject = SUBJ NewMail.Body = MSG NewMail.Recipients.Add RCP NewMail.Attachments.Add ATT NewMail.Send |
#4
|
|||
|
|||
![]()
Well, I can't help it if Microsoft has changed their URLs once again. I got to the redirect page at http://msdn2.microsoft.com/en-us/library/d6dw7aeh.aspx with no problems.
-- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "ac2006" wrote in message ... Hi Sue, Thank you for your response. However, the link you provided takes me to two redirect pages and at the final page it crashes out both I.E. and Firefox. Do you happen to have another link with the same info? --Ali "Sue Mosher [MVP-Outlook]" wrote: Outlook doesn't know anything about files. You either have to know the name or use FileSystemObject or other methods to determine the file name. See http://msdn.microsoft.com/library/en...jsfsotutor.asp for an FSO reference. "ac2006" wrote in message ... Hello, I'd like to script sending a message with an attachment. I've found how to do this when you know the attachment's name. But I need to script adding an attachment when I don't know it's name. The file I want to attach will always be located in C:\Reports and will always be a PDF, but the name will change every day. I tried ATT = "C:\Reports\*.pdf" but that didn't work. I copied this script from a site and modified it for my needs, I really don't know anything about scripting. Any help would be appreciated. Thank you. RCP = " MSG = "Test message" SUBJ = "Test subject" ATT = "C:\Reports\Attachment.pdf" Set Outlook = CreateObject("Outlook.Application") Set MAPI = Outlook.GetNameSpace("MAPI") Set NewMail = Outlook.CreateItem(0) NewMail.Subject = SUBJ NewMail.Body = MSG NewMail.Recipients.Add RCP NewMail.Attachments.Add ATT NewMail.Send |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Message As An Attachment | JoeCL | Outlook - Installation | 1 | August 23rd 06 05:05 PM |
e-mail attachment message | Julie Lindblad | Outlook Express | 6 | July 21st 06 05:44 PM |
Recieving a message with attachment and I can't view message body | mytwosweetpeas | Outlook - General Queries | 0 | July 7th 06 07:48 PM |
See attachment line in new message? | cjlatta | Outlook - Installation | 1 | June 15th 06 11:16 PM |
Adding attachment to message | David Wendt | Add-ins for Outlook | 5 | April 24th 06 02:28 PM |