How to automate MS Outlook - scripting

I have to generate an email at end of the day (daily-status) which is templated. I have add tasks to different list and on the top, I have to have count of these tasks such as:
X Tasks: 2 of 5
Y Tasks: 3 of 5
X Tasks:
X Task 1
X Task 2
Y Tasks:
Y Task 1
Y Task 2
Y Task 3
I don't want write code in .NET etc. Is there anyway to script outlook to update numbers above when I change the list contents automatically. Or even better, if an input box can take input for each list contents and generate the email

You could do this with a Custom Outlook form that then generates an email.
I can all be done with VBScript inside the form.
I would sugesst a good place to start is to look at http://www.outlookcode.com/article.aspx?ID=35
Marcus

Related

Access: Multi-Listbox - Select items if they equal a specific string using VBA

I have a form in access that has a listbox called 'lstLoadedFiles' which displays a list of all files that have been uploaded to my database.
This listbox contains 3 columns and is a multiselect listbox, so the user can select more than 1 item from the list at once.
The lisbox looks something like the below:
Type FileName Status
Blue Bluefile1.xls Loaded
Blue Bluefile2.xls Loaded
Red Redfile3.xls Loaded
Green Greenfile1.xls Loaded
The user can then select multiple records in this listbox and then click a button and code will run to validate the files for all items that have been selected.
This listbox can contain up to 20 filenames. I want the user to be able to select a button and it will highlight all records in the listbox related to a certain type e.g. 'Blue'. (This is needed so if a user only has all the relevant files for one type they can move through the process without having to wait for the remainder files for the others types - and they don't have to individually select all files from the listbox for the one type eg blue)
My problem is that the items in this listbox will never be in the same order and will never have the same number of files (eg 3 files may be uploaded for type blue, but the next time they run the process only 1 file might be uploaded) so using something like the following will not work:
Forms("MyForm").lstLoadedFiles.Selected(0) = True
Is there a way that I can code it to have something like the following:
If optSelectAllBlue = True Then
lstLoadedFiles. Select Items where column type = 'Blue' .....
where optSelectAllBlue would be a button. Or is this not possible with a listbox?
Thanks in advance,
Loop through listbox items and test if value = selected color and if match select item. The trick is figuring out how to make color value dynamic. If you are using an OptionGroup with only 3 radio buttons for Red/Green/Blue, then something like:
Dim x As Integer
With Me.lstLoadedFiles
For x = 0 To .ListCount - 1
If .ItemData(x) = Choose(Me.optColor, "Red", "Green", "Blue") Then .Selected(x) = True
Next
End With

How do I change fill color of tasks from Ms Project -VBA given that I have the task IDs in an array?

How do I change the fill color of tasks from Ms Project -VBA given that I have the task IDs in an array? Currently I can only perform this to a single task.
Dim ID As Long
ID = 7
Application.Find Field:="ID", test:="equals", Value:=ID
Font32Ex CellColor:=&H66CCFF

Outlook 2013 Auto-Reply with retained information from previously received email

Please see example email below:
"We have tickets available for the following basketball game:
Please email only me if you are interested and let me know which
section you want.
Please be sure to make your selection carefully and only reply once.
Basketball Game is on Tuesday 3/10 - 2 sets of 2 tickets.
Tuesday 3/19/2014 Cleveland 7:30PM
Section 101 Row K 16 – 17
Section 101 Row K 18 - 19
Section 124 Row K 1 - 2
Section 124 Row K 3 - 4"
How would I auto reply to this email with a default response of one of the selected rows?
For example, I would like my default auto-reply email to state the
following:
"Section 101 Row K 16-17. Thanks, Joe"
Details: I would like this to auto-reply to the sender EVERY time an email is received from the same sender. Basically I have to be the first to respond to an email in order to receive tickets to a basketball game. First come first serve.
You can create a VBA macro or develop an Outlook add-in if you need to get the code working on multiple PCs. The NewMailEx event of the Application class is fired when a new item is received in the Inbox.
But the simplest way is to develop a VBA macro which can be run by the Outlook rule. For example, the rule may recognize such emails and run a macro sub which should be in the following format:
public sub Test(mail as MailItem)
' do whatever you need there
end sub
where the mail object passed as an argument represents the incoming email.
In the sub you need to use the following methods from the Outlook object model:
The Reply method which creates a reply, pre-addressed to the original sender, from the original message.
The Body property which allows to set a string representing the clear-text body of the Outlook item.
The Send method which sends the e-mail message.
You may find the Getting Started with VBA in Outlook 2010 article in MSDN.

VB - How to print editable line in console

In a VB console application, how do you automatically put a string in the cursor? example:
ask for numbers
user inputs 5 15 five
show error
show back "5 15 five" back to the user so he can change five to 5 or any other integer.

Dynamically swap variables

I'm working in Visual Basic 2010
Hitpoints1 -= Player1HandGroup(Number).DamageInteger
This is an example line of code in a game I'm designing that removes a given amount of hitpoints from player 1 depending on the item used in the array.
For each player I have different variables. They are
Hitpoints2, Hitpoints3, Hitpoints4, Hitpoints5 respective for each given player.
What I want to do is be able to dynamically change the variable to another variable so I do not have to copy my giant masses of decision logic.
The way the variable will be dynamically changed is via a custom dialog box with Player 1 through Player 5 as the buttons to decide who the player will attack. (I've already made the dialog box)
So if I hit player 2 in the dialog box Hitpoints1 will instead be Hitpoints2.
I'd like to dynamically change the variable, or be able to concatenate the last letter (numbers 1-5) onto "HitPoints" in the code, in effect being the same as dynamically changing the variable.
One person tried to have me do for each loop...
for n = 1 to 5
HitPoints = HitPoints & n
( your code in here with the HitPoints bit, which will now be HitPoints1)
next n
but that didn't work.