Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > microsoft.public.excel.programming > #109662
| From | Tslebyng224 <Txlebjng923@gmail.com> |
|---|---|
| Newsgroups | microsoft.public.excel.programming |
| Subject | Re: posting this here cuz the outlook programing group is very inactive... |
| Date | 2016-11-24 00:03 +0000 |
| Message-ID | <Tslebyng224.127bee79@excelbanter.com> (permalink) |
| Organization | ExcelBanter.com |
| References | <9cbcab3c-cb34-466d-a3a0-5886d311bf6a@googlegroups.com> |
Matthew Dyer;1627237 Wrote: > hopefully with how active you guys are you can help! I apologize in > advance for posting an outlook vba question in an excel vba group. I've > got this loop that automatically detects for pdf file attachments in a > selected range of email items, saves them to Temp so that I am able to > then run a shell to print them. Since sometimes there ARENT pdf > attachments, I want to only have the flag status change to complete if > the e-mail has a pdf attachment. logically, where I have the flagstatus > event occur in my loop makes sense to me, but it only changes the > flagstatus for the first item in my selection. Here's to hoping someone > smarter than me can figure out what's going on here. Public Sub > SaveandPrintAttachments() Dim objOL As Outlook.Application Dim objMsg As > Outlook.MailItem Dim objAttachments As Outlook.Attachments Dim > objSelection As Outlook.Selection Dim i As Long Dim lngCount As Long Dim > strFile As String Dim strFolderpath As String Dim strExePath As String ' > Get the path to your My Documents folder strFolderpath = > "c:\temp\" Set objOL = > CreateObject("Outlook.Application") Set objSelection = > objOL.ActiveExplorer.Selection ' Set the Attachment folder. (Folder must > exist.) strFolderpath = strFolderpath For Each objMsg In objSelection > Set objAttachments = objMsg.Attachments lngCount = objAttachments.Count > If lngCount > 0 Then For i = lngCount To 1 Step -1 strFile = > objAttachments.Item(i).FileName If Right(strFile, 3) = "pdf" > Then strFile = strFolderpath & strFile > objAttachments.Item(i).SaveAsFile strFile 'use ShellExecute to open the > file 'this may not work with zip extension if you use Compressed folders > ShellExecute 0, "print", strFile, vbNullString, vbNullString, > 0 objMsg.FlagStatus = olFlagComplete End If Next End If Next ExitSub: > Set objAttachments = Nothing Set objMsg = Nothing Set objSelection = > Nothing Set objOL = Nothing End Sub It is in reality a great and helpful piece of info. I'm satisfied that you shared this helpful info with us. Please keep us informed like this. Thanks for sharing. -- Tslebyng224
Back to microsoft.public.excel.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
posting this here cuz the outlook programing group is very inactive... Matthew Dyer <matthew.e.dyer@gmail.com> - 2016-11-22 15:05 -0800
Re: posting this here cuz the outlook programing group is very inactive... phamhang29753 <phamhang29753@gmail.com> - 2016-11-23 03:07 +0000
Re: posting this here cuz the outlook programing group is very inactive... GS <gs@v.invalid> - 2016-11-23 00:08 -0500
Re: posting this here cuz the outlook programing group is very inactive... Matthew Dyer <matthew.e.dyer@gmail.com> - 2016-11-23 07:10 -0800
Re: posting this here cuz the outlook programing group is very inactive... GS <gs@v.invalid> - 2016-11-23 12:52 -0500
Re: posting this here cuz the outlook programing group is very inactive... Matthew Dyer <matthew.e.dyer@gmail.com> - 2016-11-23 10:54 -0800
Re: posting this here cuz the outlook programing group is very inactive... GS <gs@v.invalid> - 2016-11-23 14:19 -0500
Re: posting this here cuz the outlook programing group is very inactive... aokoa12 <aokoa12@gmail.com> - 2016-11-23 08:36 +0000
Re: posting this here cuz the outlook programing group is very inactive... Tvlebung396 <Tblebsng105@gmail.com> - 2016-11-23 15:03 +0000
Re: posting this here cuz the outlook programing group is very inactive... Tvlebung396 <Tblebsng105@gmail.com> - 2016-11-23 16:05 +0000
Re: posting this here cuz the outlook programing group is very inactive... Claus Busch <claus_busch@t-online.de> - 2016-11-23 22:05 +0100
Re: posting this here cuz the outlook programing group is very inactive... Tslebyng224 <Txlebjng923@gmail.com> - 2016-11-24 00:03 +0000
Re: posting this here cuz the outlook programing group is very inactive... Tslebyng224 <Txlebjng923@gmail.com> - 2016-11-24 03:04 +0000
Re: posting this here cuz the outlook programing group is very inactive... PhunuSEO <PhunuSEO@gmail.com> - 2016-11-24 06:05 +0000
csiph-web