Launch msn messenger box by clicking on a name in excel? Help! Urg

D

Dan

Hi all,

I have a question that i've yet to be able to find the answer to. I work in
the entertainment industry and we have a large upcoming show where we have
50+ people that are allocated to various places around a convention center.

There is one central hub where information will go out to various people via
msn messenger at different times. I've set up a spreadsheet (in excel 07) on
where everyone will be at what times and what they are in charge of, but i'm
wondering if its possible to do programming so if there's a message that
needs to go out to a certain person, the person sitting at the central hub
location can simply look up on the spreadsheet who is there, click on the
box(or do some kind of action), and it will automatically open up a msn
window addressed to that person and they can type the message (this would be
assuming msn messenger is up and running and all names have been added so it
would be just like double clicking a name in msn messenger and a box opening
up).

Does anyone out there have the knowhow to do somethinglike that? is it
possible?

Of course there's always the old-school way of just looking up the name on
msn and typing it but i'm trying to make this as seamless as possible since
there will be a lot of information flowing out.

I really appreciate it if anyone could help me with this! Unfortunately i'm
waiting until the last second as I'll need to get this out to people by
Tuesday!

Thanks a lot in advance for the advice!
 
D

Dan

But in the short, what i'm looking to do is impossible?

I understand the re-inventing the wheel, but its really not, its saving a
step that could ultimately save a lot of time. Lets say someone needs to
message the person in charge of one of the rooms that goes at 1:30PM. They
look it up in excel find that person and click on them to open a message box
in msn and tell them what they need to say.

If not they'd have to look up the name in excel, open msn messenger, search
for the name (out of over 50 contacts) and double click on the name then time
the message.

Now repeat this action 100's of times a day we're talking possibly over an
hours worth of work saved.

Let me know if anyone else knows how to do this or if this is possible!

Thanks for the help!
 
D

Dan

Simon Lloyd said:
Well you can launch any .exe file with Excel, however to launch a
messenger window you will have to know the trigger for that and insert
it in this code, although i do not think you will be able to open the
window as a certain username.

You say you want to open the messenger window to a certain contact and
then someone will type the information, it seems like you're re
inventing the wheel....msn does this beautifully, lists all the names
too (if they are already added friends or contacts of yours.

That said here's the code i promised
Code:
--------------------
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Sub test()
ShellExecute 0, vbNullString, "MyExe.exe", vbNullString, "C:\", 1
End Sub
--------------------





--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
 
J

Jie Wang [MSFT]

Hi Dan,

If you want to start a Messenger chat from within the Excel, you need to
write some VBA code.

First you need to add a reference to the Messenger API from your Excel VBA
project.

1. Open the Microsoft Visual Basic IDE in Excel (Alt + F11).
2. From the Main menu, choose Tools -> References
3. In the References - VBAProject dialog, check the "Messenger API Type
Library" (You'll need Messenger installed to get this).
4. Click OK to close the dialog.
5. Add the a new Module to your VBA project.
6. Add the following code:

Sub StartChat(ByVal contact As String)
Dim messenger As MessengerAPI.messenger

Set messenger = New MessengerAPI.messenger

messenger.InstantMessage contact
End Sub

Now you can call the StartChat Sub passing in the contact address like:

Call StartChat("(e-mail address removed)")

The Messenger chat window will popup as you wanted.

Hope this helps. If you have any further questions, please kindly let me
know.

Thanks,

Jie Wang

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

Dan

Wow This is great, but not working due to my lack of knowledge. Could you
help or someone advise just a little bit more? See comments below:

"Jie Wang [MSFT]" said:
Hi Dan,

If you want to start a Messenger chat from within the Excel, you need to
write some VBA code.

First you need to add a reference to the Messenger API from your Excel VBA
project.

1. Open the Microsoft Visual Basic IDE in Excel (Alt + F11).
2. From the Main menu, choose Tools -> References
3. In the References - VBAProject dialog, check the "Messenger API Type
Library" (You'll need Messenger installed to get this).
4. Click OK to close the dialog.

^^^ Got that part done, nice easy for dummies walkthrough!
5. Add the a new Module to your VBA project.
6. Add the following code:

Sub StartChat(ByVal contact As String)
Dim messenger As MessengerAPI.messenger

Set messenger = New MessengerAPI.messenger

messenger.InstantMessage contact
End Sub


^^^ OK, this was not explained, but I went to insert->module and pasted in
the above. The strange thing is when I went to save it told me I didn't
assign a macro to it. let me give you exact message:

"The following features cannot be saved in macro-free workbooks:

* VB Project

To Save a file with these features, click No, and then choose a
macro-enabled file type in the File Type list.

To continue saving as a macro-free workbook, click Yes."

No i'm almost positive this is where i'm messing up, but I clicked yes and
saved as a slightly renamed file.

Now you can call the StartChat Sub passing in the contact address like:

Call StartChat("(e-mail address removed)")

The Messenger chat window will popup as you wanted.


^^^ In a cell I have the person's name. How would I add that Call
StartChat("(e-mail address removed)") so that when they click on the name the
messenger will pop up? is it like a =MACRO(etc etc etc)? or something like
that?
Hope this helps. If you have any further questions, please kindly let me
know.


I love this and I would love to get this to work! If you could explain it
for dummies i'd love it even more! I simply dont do much programming in Excel.

Thanks!
 
D

Dan

OK I actually understand the message I was getting, I just need to save my
excel with a different extension since i'm using code. I'm still not able to
get it to work though.

Even if I put Call StartChat("(e-mail address removed)") into a cell when i click
it just pulls up outlook to email the person.

I'm sure i'm missing something basic here, but here's what I want to do if
possible

Show the persons name. Let's say the name is Dan the cell would just show
Dan but it would be clickable and if they click it it would pull up the
messenger box associated with Dan's email.


I think i'm close here thanks to your help, can you help me finish this deal?

Thanks a lot!


Dan said:
Wow This is great, but not working due to my lack of knowledge. Could you
help or someone advise just a little bit more? See comments below:

"Jie Wang [MSFT]" said:
Hi Dan,

If you want to start a Messenger chat from within the Excel, you need to
write some VBA code.

First you need to add a reference to the Messenger API from your Excel VBA
project.

1. Open the Microsoft Visual Basic IDE in Excel (Alt + F11).
2. From the Main menu, choose Tools -> References
3. In the References - VBAProject dialog, check the "Messenger API Type
Library" (You'll need Messenger installed to get this).
4. Click OK to close the dialog.

^^^ Got that part done, nice easy for dummies walkthrough!
5. Add the a new Module to your VBA project.
6. Add the following code:

Sub StartChat(ByVal contact As String)
Dim messenger As MessengerAPI.messenger

Set messenger = New MessengerAPI.messenger

messenger.InstantMessage contact
End Sub


^^^ OK, this was not explained, but I went to insert->module and pasted in
the above. The strange thing is when I went to save it told me I didn't
assign a macro to it. let me give you exact message:

"The following features cannot be saved in macro-free workbooks:

* VB Project

To Save a file with these features, click No, and then choose a
macro-enabled file type in the File Type list.

To continue saving as a macro-free workbook, click Yes."

No i'm almost positive this is where i'm messing up, but I clicked yes and
saved as a slightly renamed file.

Now you can call the StartChat Sub passing in the contact address like:

Call StartChat("(e-mail address removed)")

The Messenger chat window will popup as you wanted.


^^^ In a cell I have the person's name. How would I add that Call
StartChat("(e-mail address removed)") so that when they click on the name the
messenger will pop up? is it like a =MACRO(etc etc etc)? or something like
that?
Hope this helps. If you have any further questions, please kindly let me
know.


I love this and I would love to get this to work! If you could explain it
for dummies i'd love it even more! I simply dont do much programming in Excel.

Thanks!
Thanks,

Jie Wang

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

Dan

I can't get far into this because when I start up the excel it pulls up a
person online but not the offline people.

If I click get contacts it says unable to update contact list out of memory

if I click on the person online and click on chat it says Unable to open
chat window with contact "". Out of memory even though I have them selected.

Any ideas on this stuff?

Thanks!







"Jie Wang [MSFT]" said:
Okay, one thing I must point out first: we must pass the "signin name" (AKA
email address AKA MSN Passport AKA Windows Live ID) of the contact so
Messenger knows exactly who you want to chat with. Otherwise, what if you
got two contacts in your Messenger both named "Dan"? But the "signin name"
is unique regardless of the friendly name which can be changed by its owner
from time to time.

I made a working sample (a xlsm file) containing everything (VBA code) you
need. Including code to populate all the contacts in your Messenger contact
list, and a small window with a button floating on top of the Excel. When
you select a row in the sheet which contains a contact record (Friendly
name + Signin name + Status), and press the Chat button in that window, the
Messenger chat window will open.

I'm trying to send the sample file attached with this reply. If you cannot
get the attachment, you can also get the file from my SkyDrive:
http://cid-b5f87dcdf8f1fe53.skydrive.live.com/self.aspx/.Public/Messenger.xl
sm

If you have any questions about the sample, please let me know.

Thanks,

Jie Wang

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights
 
J

Jie Wang [MSFT]

Hi Dan,

What version of Messenger you're using?

I tested the sample against Windows Live Messenger version 2009 (build
14.0.8064.206).

Also, do you have any third party plug-in for Messenger installed?

Currently I can't think of an obvious reason why you met the "out of
memory" error. If possible, could you also try the sample on some other
machines and see if you get the same error or not?

Thanks,

Jie Wang

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

Dan

Interesting. I've tried it on two different computers with the same result.
On the first computer I used the messenger you get when you install windows
(the non-live one) because if I go to tools and click references the windows
api check box has a target of program files/messenger/msmsgs.exe

I notice your target has the above but with a /3 afterward. that directory
does not exist for me.

for windows live my directory is program files/windows
live/Messenger\msnmsgr.exe


I'm wonering if maybe this is the problem? how would you suggest fixing this?

Thanks!
 
J

Jie Wang [MSFT]

Oh, the backslash and the number indicates the type library location inside
that EXE file, it should be like that.

Could you debug the macro in single step and find out which exact line of
code caused the Out of Memory error?

With this information only we can see what can do to fix the problem.

Thanks,

Jie Wang

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

Dan

From

Set msg = New MessengerAPI.Messenger

it jumps right to:

MsgBox "Unable to get contact list." & _
vbCrLf & vbCrLf & Error, vbOKOnly Or vbCritical

And thats when it spits out the memory error:

"Unable to get contact list.
Out of memory".


I've tried with having both the old messenger (the one that comes up when
you run the exe file that we call in that directory) and windows live
messenger.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top