Great, now you see why the msgbox pops up, it´s because some emails have more than just the expected attachments. Your error is a logical one: You don´t know at which position the Excel attachment is, so you cannot display the "not found" message and leave the loop as soon as it hits a non Excel...
Yes, by default the Instr function is case-sensitve. Use it this way if instr(1,"xxx",vbtextcompare). You need to test it; I always forget whether vbTextCompare or vbBinaryCompare makes it case-insensitive.
In order to check for more words, use it this wayif instr(...)>0 or instr(...)>0 then...
set a breakpoint on this line:
Private Sub inboxItems_ItemAdd(ByVal Item As Object)
Then move an item into the folder. The code execution will stop at the breakpoint. Walk through it step by step by pressing f8, and see where it doesn´t do what you`d expect.
That should mean oOlAtch is declared as object, not as attachment. You can also open the local window to look at a variable´s content. Or select all the "oOlAtch.Filename", then press shift+f9.
Sure. You need to look at the content of the oOlAtch.Filename property. One method to do so is to hover with the mouse over "FileName". That should display the prop´s content in a tooltip.
If you set a breakpoint on the line with the message box, then place the mouse over the FileName property when the code execution stops , what does it display?
To write the view into an email, replace everything within the first If and last End IF by this one:
Dim Mail as MailItem
set mail=application.createitem(0)
mail.body=sourcefolder.currentview.xml
mail.save
Make sure there´s only the view definition in the body, no signature etc.
This one saves...
This sample shows how to read the view by VBA: Copy Folder Views - VBOffice
You could, for instance, write the xml property to the body of an email. However, with this approach you´d need to install a macro to import from the email on all the users computers. Not sure, if that´d accelerate anything.
A small change does it. You cannot set the type for all recipients at once but have to do it for each single recipient.
dim r as recipient
set r=Appt.Recipients.Add ("xxxx@yyyyyy.zz")
r.Type = olBCC
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.