A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Voting Buttons & Excel



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 7th 06, 04:34 AM posted to microsoft.public.outlook.program_vba
Junoon
external usenet poster
 
Posts: 27
Default Voting Buttons & Excel

Hi,

I have created Voting Buttons for people with 24 Time slots for the 24
hrs of the day...

e.g. 8:30 am; 9:30 am; 10:30 am etc....

When a person clicks on his appropriate choice, i would receive the
message in my Outlook Inbox folder & then from folder, the voted time
should automatically go into the B column on a worksheet named
"ChooseTime", & then A column would should show the sender's email ID
or name...

Col A Col B
Email ID Chosen Time
------------------------------------

How do i collect the votes....

N.B: The Subject of the email sent to all the person's will be
"ChooseTime", i.e the same as the Worksheet name..viz., "ChooseTime"...

PLEASE HELP ASAP!

Ads
  #2  
Old April 7th 06, 09:24 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Voting Buttons & Excel

The easiest way to do this is to create a new View in your Inbox, remove
columns that you don't want, and add the VotingResponse field and any others
you want in the spreadsheet (you should probably create a filter too to
restrict any messages that don't have a VotingResponse value. Then select
all the messages and press CTRL+C. Then paste it into Excel.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Junoon" wrote:

Hi,

I have created Voting Buttons for people with 24 Time slots for the 24
hrs of the day...

e.g. 8:30 am; 9:30 am; 10:30 am etc....

When a person clicks on his appropriate choice, i would receive the
message in my Outlook Inbox folder & then from folder, the voted time
should automatically go into the B column on a worksheet named
"ChooseTime", & then A column would should show the sender's email ID
or name...

Col A Col B
Email ID Chosen Time
------------------------------------

How do i collect the votes....

N.B: The Subject of the email sent to all the person's will be
"ChooseTime", i.e the same as the Worksheet name..viz., "ChooseTime"...

PLEASE HELP ASAP!


  #3  
Old April 8th 06, 01:41 AM posted to microsoft.public.outlook.program_vba
Junoon
external usenet poster
 
Posts: 27
Default Voting Buttons & Excel

hi eric,

Thanks for your reply.

Then select all the messages and press CTRL+C. Then paste it into Excel.


I want to automate the whole process, so that i dont have to open each
mail of 350 persons & then copy-paste into excel, for which email id(
person) has selected which time.

I am new to outlook & have code to :

1] Check if Outlook is open & running...if not, show message to inform
user & then quit function....
2] Select Inbox folder & then create a new folder for delivering voting
messages from persons...
3] An Excel sheet which has the VBA code for the above but,

What i want is VBA code to process the Voting emails in that folder &
extract them to Excel sheet starting at say A2...

Column Cells A1 to Z1 will have.....

Email
ID 8:30 9:30 10:30 11:30 12:30 13:30 14:30 15:30 16:30 17:30 18:30 19:30 20:30 21:30 22:30 23:30 0:30 1:30 2:30 3:30 4:30 5:30 6:30 7:30 8:30

Below them, i want to get the appropriate Yes /No response from the
Processed mails below the chosen time, along with the Email ID (Email
address) of the person who has sent the email....


PLEASE HELP!

Warm Regards,

  #4  
Old April 10th 06, 04:36 AM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Voting Buttons & Excel

Actually, you don't have to open each e-mail individually. If you select the
voting messages in the folder, you can simply copy them much like you're
copying a series of rows in Excel. The rows and fields that you see will be
pasted exactly as you look into the spreadsheet. I recommend this approach,
as all you have to do is tailor your spreadsheet to accept the format/layout
of the View you're pasting from (which you can change, as I said in my last
post) and you don't need to write any code at all.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Junoon" wrote:

hi eric,

Thanks for your reply.

Then select all the messages and press CTRL+C. Then paste it into Excel.


I want to automate the whole process, so that i dont have to open each
mail of 350 persons & then copy-paste into excel, for which email id(
person) has selected which time.

I am new to outlook & have code to :

1] Check if Outlook is open & running...if not, show message to inform
user & then quit function....
2] Select Inbox folder & then create a new folder for delivering voting
messages from persons...
3] An Excel sheet which has the VBA code for the above but,

What i want is VBA code to process the Voting emails in that folder &
extract them to Excel sheet starting at say A2...

Column Cells A1 to Z1 will have.....

Email
ID 8:30 9:30 10:30 11:30 12:30 13:30 14:30 15:30 16:30 17:30 18:30 19:30 20:30 21:30 22:30 23:30 0:30 1:30 2:30 3:30 4:30 5:30 6:30 7:30 8:30

Below them, i want to get the appropriate Yes /No response from the
Processed mails below the chosen time, along with the Email ID (Email
address) of the person who has sent the email....


PLEASE HELP!

Warm Regards,


  #5  
Old April 10th 06, 11:13 PM posted to microsoft.public.outlook.program_vba
Junoon
external usenet poster
 
Posts: 27
Default Voting Buttons & Excel

Hi Eric,

Thanks for your reply, but i want to know if there is a way to code
this out as there will be different voting options on different
computers & the no of employees is more. the other computers would be
used by people who are not adept at all.

Just a click of button to get the voting data into my computer would
solve the problem.

If you could just give a simple example would really help.

I went thru the Outlook VBa help, & it shows that Mail Items
VotingResponse & VotingOptions, but donot know how to code that to
transfer voting data.

PLEASE HELP!

Warm Rgds,

  #6  
Old April 11th 06, 04:18 AM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Voting Buttons & Excel

Okay, you're going to make me work for my supper eh? :-)

Try the macro below. It will collect the votes for all e-mails in your
Inbox. Just change the path to the worksheet file, and ensure that the dates
are in the first row and that the cells are formatted as Text.

Sub CollectVotesToExcel()
Dim objNS As Outlook.NameSpace
Dim objInbox As Outlook.MAPIFolder
Dim objMail As Outlook.MailItem, objItem As Object

Dim objExcel As Excel.Application
Dim objWks As Excel.Worksheet, objWkb As Excel.Workbook
Dim objTimeRange As Excel.Range, objRange As Excel.Range

Dim intX As Integer

Set objNS = Application.GetNamespace("MAPI")
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)

Set objExcel = New Excel.Application
objExcel.Workbooks.Open "C:\MyWorkbook.xls"
objExcel.Visible = True
Set objWks = objExcel.ActiveSheet 'Use default Sheet1
Set objTimeRange = objWks.UsedRange
For Each objItem In objInbox.Items
If objItem.Class = olMail Then
Set objMail = objItem
If objMail.VotingResponse "" Then
Set objRange = objTimeRange.Find(objMail.VotingResponse, , ,
xlWhole)
If Not objRange Is Nothing Then
objWks.Cells(2, objRange.Column).Value =
objMail.SenderEmailAddress
End If
End If
End If
Set objMail = Nothing
Set objItem = Nothing
Next

Set objRange = Nothing
Set objTimeRange = Nothing
Set objMail = Nothing
Set objWkb = Nothing
Set objWks = Nothing
Set objExcel = Nothing
Set objNS = Nothing
Set objInbox = Nothing
End Sub

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Junoon" wrote:

Hi Eric,

Thanks for your reply, but i want to know if there is a way to code
this out as there will be different voting options on different
computers & the no of employees is more. the other computers would be
used by people who are not adept at all.

Just a click of button to get the voting data into my computer would
solve the problem.

If you could just give a simple example would really help.

I went thru the Outlook VBa help, & it shows that Mail Items
VotingResponse & VotingOptions, but donot know how to code that to
transfer voting data.

PLEASE HELP!

Warm Rgds,


  #7  
Old April 13th 06, 09:01 AM posted to microsoft.public.outlook.program_vba
Junoon
external usenet poster
 
Posts: 27
Default Voting Buttons & Excel

Hi Eric,

1] Just to let you know, i am using Excel 97 at office & so
objMail.SenderEmailAddress does not work.

2] Also, your code creates a new workbook alltogether which i donot
want. i am trying to run the code & get the results in the same
workbook.

3] I tried using objMail.SenderName, instead of
objMail.SenderEmailAddress. But, i get a Security Warning dialog to
Allow Outlook Access with a drop down list box to select time.

4] also, i have to put time in Quotes when creating a voting
mail....i.e. "0:00";0:30"; etc....only then it appears as buttons to
Employees, otherwise not?????

Anyway, just to let you know, the 1st column is the Email ID column
(A1) & the subsequent columns (starting B1) are for the times in text
(as you suggested).
Now , i saw that whenever someone sends a Voting response, i receive
his email with the Subject as the Voting Response.

1] Can i not compare objMail.SenderName with the person's name in say
Column A (Email ID), & if Found, then put a "Yes" on his respective
time chosen ,then Loop similarly through other emails & get other
responses for persons in Column A???

2] Also, If i send a Voting Email with the Time Buttons, Whose Body of
the Email contains information to be filled by employees like :

Body of the Email may contain say:
1. Drop Location ( Address): [Employee enters his address here]
2. Shift Time: [here employee will enter his shift time e.g. 7:30 -
16:30]

What i want to do is make a separate columns (for each one of the
above) on the Excel sheet, say the last columns....get the data entered
by Employees into the columns.
Say Last 2 columns would be :
Drop Location ( Address) | Shift Time |

Obviously, the Employee ( on receiving the Voting email from me) would
be clicking on Edit response, entering the body data & sending the
mail.....

I Hope i am clear & look forward to your valued response. Please help
ASAP a this would clear a lot of workload on my head regarding employee
transport issues, which is a mess right now...This idea is just what i
thought could solve the problem, but the employee count is more than i
can handle.....

PLEASE HELP ASAP

  #8  
Old April 13th 06, 03:17 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Voting Buttons & Excel

First, you have two sets of numbered lists in your response, so I'll compose
my responses condensed into one set:

1) Right, you can only use the SenderEmailAddress propery with Outlook 2003.
For other methods, see:

To get the sender's address from a Microsoft Outlook mail message (code
samples):
http://www.outlookcode.com/d/code/getsenderaddy.htm

You can most certainly use the SenderName to lookup a value in a column and
insert values in the same row in other columns. Use Excel's Range object and
Cells collection, as well as the Find method I demonstrated, to do all this.

2) My code sample doesn't create a new workbook, it opens an existing one.

You can also parse the contents of the message body if you want, and insert
columns into the spreadsheet. You can do anything you want!

3) See: Microsoft Outlook "Object Model Guard" Security Issues for
Developers:
http://www.outlookcode.com/d/sec.htm

4) If quotes around dates work for Voting buttons, then continue to use it!

Good luck Junoon. A lot of what you want to do is possible, but will
require some effort and learning on your part to write the complete solution.
I can offer some guidance and answer any glaring technical issues, but the
code sample I already provided should give you a good starting point.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Junoon" wrote:

Hi Eric,

1] Just to let you know, i am using Excel 97 at office & so
objMail.SenderEmailAddress does not work.

2] Also, your code creates a new workbook alltogether which i donot
want. i am trying to run the code & get the results in the same
workbook.

3] I tried using objMail.SenderName, instead of
objMail.SenderEmailAddress. But, i get a Security Warning dialog to
Allow Outlook Access with a drop down list box to select time.

4] also, i have to put time in Quotes when creating a voting
mail....i.e. "0:00";0:30"; etc....only then it appears as buttons to
Employees, otherwise not?????

Anyway, just to let you know, the 1st column is the Email ID column
(A1) & the subsequent columns (starting B1) are for the times in text
(as you suggested).
Now , i saw that whenever someone sends a Voting response, i receive
his email with the Subject as the Voting Response.

1] Can i not compare objMail.SenderName with the person's name in say
Column A (Email ID), & if Found, then put a "Yes" on his respective
time chosen ,then Loop similarly through other emails & get other
responses for persons in Column A???

2] Also, If i send a Voting Email with the Time Buttons, Whose Body of
the Email contains information to be filled by employees like :

Body of the Email may contain say:
1. Drop Location ( Address): [Employee enters his address here]
2. Shift Time: [here employee will enter his shift time e.g. 7:30 -
16:30]

What i want to do is make a separate columns (for each one of the
above) on the Excel sheet, say the last columns....get the data entered
by Employees into the columns.
Say Last 2 columns would be :
Drop Location ( Address) | Shift Time |

Obviously, the Employee ( on receiving the Voting email from me) would
be clicking on Edit response, entering the body data & sending the
mail.....

I Hope i am clear & look forward to your valued response. Please help
ASAP a this would clear a lot of workload on my head regarding employee
transport issues, which is a mess right now...This idea is just what i
thought could solve the problem, but the employee count is more than i
can handle.....

PLEASE HELP ASAP


  #9  
Old April 14th 06, 01:10 AM posted to microsoft.public.outlook.program_vba
Junoon
external usenet poster
 
Posts: 27
Default Voting Buttons & Excel

Thanks for your reply Eric.

1] I want to know is it possible to totally bypass the security box in
Outlook 97?

2] If i use FIND to search & compare the SenderName, would i still get
the security dialog. ....the reason i am asking is bcos it will slow
the process & i would have to click Yes for each email that is
processed.

3] is it possible to dump the processed mails to a automatically
created new folder, so that they cannot get processed again when i run
the code the next time? How to do it?

Warm Regards,

  #10  
Old April 14th 06, 05:15 PM posted to microsoft.public.outlook.program_vba
Junoon
external usenet poster
 
Posts: 27
Default Voting Buttons & Excel

Hi Eric,

This is What i have made....
************************************
Function CreateInboxFolder(oInbox, Fldr) As Object

Dim oFold As Object

'Look for archive folder and create if doesn't exist, create it
On Error Resume Next 'ignore error
Set oFold = oInbox.Folders(Fldr)
If Err.Number 0 Then Err.Clear

If oFold Is Nothing Then
Set oFold = oInbox.Folders.Add(Fldr, olFolderInbox)
End If

Set CreateInboxFolder = oFold

End Function
Function GetOutlook() As Object

Dim olApp As Object

On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
On Error GoTo 0
If olApp Is Nothing Then
MsgBox "Outlook is not running: please open the application first"
End If

Set GetOutlook = olApp

End Function

Sub CollectVotes()

Dim objNS As Outlook.NameSpace
Dim objInbox As Outlook.MAPIFolder
Dim objMail As Outlook.MailItem
Dim objItem As Object
Dim olApp As Outlook.Application

If olApp Is Nothing Then
Set olApp = GetOutlook()
End If


Dim objWks As Excel.Worksheet
Dim objTimeRange As Excel.Range, objRange As Excel.Range
Dim iRow
Dim FolderName As Object

On Error Resume Next
Set objNS = olApp.GetNamespace("MAPI")
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)

Set objWks = ThisWorkbook.Worksheets(ActiveSheet.Name) 'Use default
Sheet1
With objWks
iRow = objWks.Cells(objWks.Rows.Count, 1).End(xlUp).Row + 1
End With

Set objTimeRange = objWks.UsedRange

For Each objItem In objInbox.Items
If objItem.Class = olMail Then
Set objMail = objItem
If objItem.VotingResponse "" Then
Set objRange =
objTimeRange.Find(objMail.VotingResponse, , , xlWhole)
If Not objRange Is Nothing Then
objWks.Cells(iRow, 1).Value =
objMail.SenderName
objWks.Cells(iRow, objRange.Column).Value = "Y"
objWks.Cells(iRow, 50).Value =
Trim(objMail.Body)
End If
Set FolderName = CreateInboxFolder(objInbox, "Votes" &
"-" & Date)
objMail.Move FolderName
iRow = iRow + 1
End If
End If
Next

Set objItem = Nothing
Set objRange = Nothing
Set objTimeRange = Nothing
Set objMail = Nothing
Set objWks = Nothing
Set objExcel = Nothing
Set objNS = Nothing
Set objInbox = Nothing
Set olApp = Nothing

End Sub
**********************************

But if you look at the above code, ......objWks.Cells(iRow, 50).Value =
Trim(objMail.Body) is "Location" Column, & i want to just get the
Location from the Body of the mail.

The Body of the Voting Mail would be having 3 entries each on a line:
Location:
EmpID:
Shift Time:

1] If i make extra Columns after last time column (23:30) for the Shift
time, for each of the above parameters, viz., Location, EmpID, Shift
Time......How do i extract their data from the Body of the
Messages......

2] Also, if instead i have a Column of names in the 1st column & i am
not dumping any sender Names using code, how do i compare the names in
1st column & just have a "Y" reflecting under their chosen
time......Comparison would be faster.....
I just have an idea, that i would be able to extract the data using
Compare or Instr function.......

Please give me an example as i am really stuck at the last moment......


PLEASE HELP!

Cheers!

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
import excel names & emails help Chris at the Inn Outlook - Using Contacts 1 April 7th 06 09:02 PM
Can i export an excel sprd of contact name & adresses into outlok jjhansen20 Outlook - Using Contacts 1 March 18th 06 04:34 PM
missing voting buttons, missing response toolbar [email protected] Outlook - General Queries 4 March 1st 06 04:49 PM
Automation of voting buttons [email protected] Outlook - Using Forms 0 February 2nd 06 01:09 PM
How do I set up a voting buttons with hyperlink? Sunny Outlook - General Queries 1 January 24th 06 02:51 PM


All times are GMT +1. The time now is 09:32 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.