I have a rule which starts a sub in VBA when a new eMail arrives.
The code automatically saves the attachment of the Mail in a specific folder.
This worked fine, as long as..... I reinstalled the system.
I added everything like it was, but now I'm suffering the following problem:
When the rule hits in, the eMail Object always has zero attachments. I was sniffing around a little bit and found out, that the Downloadstate is still zero (header only) when the sub runs.
On the web we can see lots of code snippets around for this functionality but Downloadstate seems never to be a topic. So it wasn't for me in the past!
What is wrong here? Why is the Downloadstate zero when the VBA Sub starts?
I found a little workaround by querying the downloadstate and re-run the procedure again with the same mail item. This loop works fine. Almost on the next run it seems that the message is fully downloaded already... And the procedure takes place like it should. But as i know that it worked fine right before, I just want to get rid of this again...
Can anybody help?
Related
I am working on a simple Marco that use to download selected emails' attachments.
It was really a simple logic but I am still stuck.
I found out that my for each loop is always stop when it met the meeting request email.
(It almost took my whole day to figure it out that the meeting request is The Barricade.)
The problem can be fixed by deletion of the meeting request.
And yet, it is really annoying for a lazybones like me.
Therefore, I really curious that is there any method can let the for each loop just ignore/auto unselect meeting requests?
And I have already tried detect the email subject/context to seprate the meeting requests and normal mails.
But it seem like it would just exit the for each loop when it encountered the meeting request.
So currently I don't have any idea about how to fixing it.
Firstly, you need to show the relevant snippet of your code.
Secondly, you should not assume that you are only dealing with the MailItem objects - before accessing an of the MailItem-specific properties, check that the Class property (it is exposed by all OOM objects) is 43 (which is olMail).
I can usually find an answer by searching the forum and applying my own answer but this has me stumped.
I have some vba in ThisOutlookSession that when a mail item is sent from a shared mailbox it moves that item into the sent items of the shared mailbox rather than the individuals. This has been working fine for roughly about a year...
For some reason in the last two weeks or so it has suddenly started to put two copies of the message into the shared mailbox sent items.
Whilst investigating this I noticed something, I entered a Stop line at the start of my code to allow me to step through it. The code fires, hits the Stop line and Stops as it should, however the item has already moved into the shared mailbox... I then step through the rest of the code and it moves the item again...
This is already strange, but what really got me is I have now deleted the code from the session (all of it nothing left), closed Outlook and rebooted the PC. I then sent a test message and guess what - its once again moved into to the shared mailbox sent items.
I haven't got any rules set up, so it cant be that... I only use ThisOutlookSession in Outlook, so its not firing from another Module
It's as though my script still exists in the background but I am unable to see it.
So my questions are:
1) has anyone else experienced this?
2) how is it possible for code to excecute when it doesn't exist (surely this is the equivalent of a human walking around without a head??)
3) does anyone have any solutions on how to resolve this?
I really hope someone out there can help because this has me completely stumped!
TIA
I have a 1-min delay on all emails and want to assign a category set up as an exception to the rule to send immediately.
I created the macro but it stopped working.
Public Sub CategoriesButton()
Dim Item As Outlook.MailItem
Set Item = Application.ActiveInspector.CurrentItem
Item.Categories = "SendMe"
Item.Save
End Sub
Interesting - I just had the same issue. Working perfectly but then I restarted Outlook and it stopped working - for no apparent reason.
Took me a while to work this out - but when you restart Outlook it applies Macro security permissions to your macro.
If you haven't digitally signed your macro, the default behaviour is to prevent it from running.
You can relax the security settings so that Outlook with either ask your permission to run macros, or just run all macros regardless (this latter option is probably not a good idea!)
You can self-sign your own macro, there's quite a good guide to doing that here: http://www.slipstick.com/developer/how-to-use-outlooks-vba-editor/
But annoyingly it seems you will always get a notification, even with a signed macro... so it's probably easier to just change the security settings to 'notification for all'.
Hope this helps - the code you posted certainly helped me, it was exactly what I was looking for, also to control 1 minute delay!
Man, every time I go near macros in Outlook I end up losing half a day or so...
The other day, I took up a little bit of a project: creating an IRC bot. Currently, it works (with a few bugs that I know about and am working towards fixing), but there is one feature that I would like to implement. External modules.
Basically, what I am wanting is to have the end user be able to write their own Sub and have that checked when a message arrives.
Each sub that is checked starts off something like this:
Sub sampleSub(message As String)
What calls that bit of code is (another) sub that is run through when a message arrives. In short, when a message arrives, the following code is executed:
sampleSub(message)
(where message = the incoming message to be processed)
Is there a way to check a folder (say, /modules) for all .vb files, compile said files to .dll, and add those to a list of subs above to be checked?
(If you don't understand what I'm meaning about the above code, see https://github.com/xeon927/IRCBot/blob/master/main.vb lines 213, and 337-348)
Now I am testing a online shop website with QTP.
The occured problem is quite tricky.
I already have an account, so I order a product, It will automatically show up my billing address.
What I need to test is that if I were to change this address, this address should be added in "my address"I can set the typed address in a variable. like (newaddress= "Sk ks, ....")
But the problem is I could not identify the created object. Because it was created during the script was running. Has anybody got an idea?
myQTP script to find the "SK ks ... " SPAN.
Set mypage = Browser("Browser").Page("Micasa")
If mypage.webelement("html tag:=span").Exist(3) Then 'or even class:=headline
msgbox "it exists"
Else
msgbox "doesn't exist"
End if
End if
It is hard for me to understand what exactly the problem is, but let me try to help you.
Have you tried putting a breakpoint on the part that gives you trouble? After placing a breakpoint, you can run your script and it automatically breaks on the point of the breakpoint.
From there, you can use the GUI spy and the Object Repository (I assume you use the O.R. and do not use Descriptive Programming?) to detect the object to make the description in the O.R. more generic.
There should be no problem identifying objects that were created during the test run. If QTP doesn't find an object it waits a bit and tries again. Your problem seems to be finding a good description for the WebElement you're looking for.
Looking at the comments on AutomatedChaos's answer it seems that you have a very minimal description (only the html tag). If this is really all you know about your WebElement you can use Visual Relations Identifiers (using QTP11) to find your element.