Outlook Macro to Contact

Status
Not open for further replies.

LMS

Senior Member
Outlook version
Email Account
Exchange Server
Is there a simple macro that would open up aspecific contact from whatever folder or subfolder it is in??? As this way if I have a some contacts eachone I can open up from a macro, I can create a combobox thru the userform thatwill show me a drop list of contacts etc….which are the macros to each contact…asI have that code that can create adroplist of macros in combobox of the userform.

 
No, this wouldn't be simple. you'd need to search for the contact to find it, then open it. Opening is fairly easy, finding takes more code. If the contact is doesn't change, you could use the EntryID - but copying the contact (and possibly syncing with smartphones) could create a new entry id.

Method 2 at http://www.slipstick.com/developer/create-task-outlookcom-local-tasks-folder/ uses entry ids.
 
ok..thanks....will forget about it!! did you see that post re the commandbotton in contact which goes to the script code that refers to an OutlookSession macro...and sometimes it just stops working with the error "object doesn't support this property r method" and then comes back working....can we fix that as you know the code in the script is: Sub CommandButton9_Click

Set myOlApp = CreateObject("Outlook.Application")

myOlApp.runthis4

End Sub
 
Top New Question Re Macro to A Contact.

I have a program that when I highlight the contact in the folder of contacts and click on the program click, and then i past to a note field in the Contact, it is a link to a contact just showing the name of the contact.....but you can show the full link that works to that contact....and here is that long long link as an example...so is there as simple macro that runs a link? that way I can create a list of macros and then to a userform and the combobox with a list of macro that open up different contacts....so here is the link that as a hyperlink in the contact note field, opens up a specific contact:

outlook:00000000406317C23ADE074B9661C902139554E8070064C2A3BEA38EA84F88B9659B3941C7D6000C3FA3014D0000DA718EB502520348975B8CD31F4E641900350F252E280000



 
That is an entry id.

use something like this in a macro -

Sub getentryid()

Dim strID As String

Dim objMail As Outlook.MailItem

Set objMail = ActiveExplorer.Selection.Item(1)

strID = objMail.EntryID

Set msg = Session.GetItemFromID(strID)

MsgBox msg.Subject

msg.Display

End Sub
 
If all this is supposes to do is open up the contact re the entryid number, where do I put the long list of numbers/letters re the link and does this create an email or just open up the contact?

Thanks
 
it just opens the contact (or whatever item's entry id you use) - the sample code picks up the 'long list of numbers' from the selected item:

' selected item:

Set objMail = ActiveExplorer.Selection.Item(1)

'assign entryid to a string
strID = objMail.EntryID

'find the item
Set msg = Session.GetItemFromID(strID)

' display it
msg.Display

if you have an entry id, you could replace strID with it:
Set msg = Session.GetItemFromID("superlong GUID goes here")
 
So do it take out the line strID = objMail.EntryID and just put superlong GUID in?? and the code would be exactly what you gave me just taking out that line and putting in the superlong???
 
yeah, if you means like this:

'assign entryid to a string

strID = "super long GUID goes here"
'find the item
Set msg = Session.GetItemFromID(strID)

that is actually the better/easier way if you aren't picking it up programmically.
 
This is what I did and this is what works.....it's different for some reason re what you just showed me so what's the difference please? Sub getentryid()
Dim strID As String
Set msg = Session.GetItemFromID("GUID")
MsgBox msg.Subject
msg.Display
End Sub
 
if GUID represents that super long code, nothing is different. It's just the other way of doing it. If you are saying you typed GUID in there and it worked, wow. It shouldn't.
 
No...it's the super long code I have to put in....not the word "GUID" Also even simpler I took out the line MsgBox msg.Subject as don't need that as well....and f there is something else easier to do re creating the macro to the contact? for example, what is the macro that I click on and it creates a macro to that contact and it stores in a specific Module that is identified in the macro to create the macro? In other words, if there is macro I click on a contact and that will create the macro that opens up the contact later, is that possible??
 
Msgbox line was just for testing, so you can see what it's grabbing without actually opening the item.

No, I'm not aware of a way to create a macro from a macro. The usual method is to use variables (strID in this macro ) and pick the EntryID at the time you run the macro so one macro works on anything.
 
So make it the following??? And where do I pick re the EntryID re a contact? Dim strID As String
Set msg = Session.GetItemFromID("strID")
MsgBox msg.Subject
msg.Display
End Sub


 
You'd use something like this to get the entry id from the currently selected item.
Dim objMail As Outlook.MailItem
Set objMail = ActiveExplorer.Selection.Item(1)
strID = objMail.EntryID <== this is the magic code that gets the id.
 
So this is a different macro that I run on a currently selected item.....so where does the entryid show up then? And What is the full macro that I can paste please?
 
It can use the same function.it can use the same function.

Try sticking these lines in one of the macros you currently use - change objMsg to whatever object name you are using.

strID = objMail.EntryID

msgbox strID
 
Thanks very much, but I don't understand...sorry...

What macro do I put this into? And I am not in place with the the words "objMsg" and what you mean by "object name"

the macro that I am using to open up a contact isthe followingand "entryid" is the entryid letters/numbers that come from that other program....do i do it in this type of macro or some other macro i use of other areas? sorry for my confusions!!
Sub Link_Test()
Set msg = Session.GetItemFromID("entryid")
msg.Display
End Sub
 
You can't get the entry id for ContactA by running a macro from ApptB - you need to identify the contact before you can get the entry ID. like, select the contact, run a macro that gets the ID.
 
So I open the contact and run the macro that shows the entryid. What is the full macro to do it and where does it then show the entryid please?
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
L Outlook 2007 Macro to Contact From a Field Using Outlook 3
L Outlook 2007 Macro Save Contact Using Outlook 10
L Outlook 2007 Macro Open Contact Folder Using Outlook 7
L Outlook 2007 Macro to Run a Script From a Contact Form Using Outlook 41
L Outlook 2007 Macro to Add Text to a Contact Field Using Outlook 10
X Custom icon (not from Office 365) for a macro in Outlook Outlook VBA and Custom Forms 1
C Outlook - Macro to block senders domain - Macro Fix Outlook VBA and Custom Forms 1
J Outlook 365 Outlook Macro to Sort emails by column "Received" to view the latest email received Outlook VBA and Custom Forms 0
M Outlook Macro to save as Email with a file name format : Date_Timestamp_Sender initial_Email subject Outlook VBA and Custom Forms 0
D Outlook 2016 Creating an outlook Macro to select and approve Outlook VBA and Custom Forms 0
S Outlook Macro for [Date][Subject] Using Outlook 1
E Outlook - Macro - send list of Tasks which are not finished Outlook VBA and Custom Forms 3
S Macro for Loop through outlook unread emails Outlook VBA and Custom Forms 2
Witzker Macro to move @domain.xx of a Spammail to Blacklist in Outlook 2019 Outlook VBA and Custom Forms 7
S Macro for other actions - Outlook 2007 Outlook VBA and Custom Forms 23
S Macro to move “Re:” & “FWD:” email recieved the shared inbox to a subfolder in outlook Outlook VBA and Custom Forms 0
S Outlook Macro to send auto acknowledge mail only to new mails received to a specific shared inbox Outlook VBA and Custom Forms 0
S Outlook Macro to move reply mail based on the key word in the subjectline Outlook VBA and Custom Forms 0
M Outlook macro to automate search and forward process Outlook VBA and Custom Forms 6
R Macro Schedule every day in Outlook Using Outlook 0
L Moving emails with similar subject and find the timings between the emails using outlook VBA macro Outlook VBA and Custom Forms 1
N How can I increase/faster outlook VBA Macro Speed ? Using Outlook 2
A Outlook macro to create search folder with mail categories as criteria Outlook VBA and Custom Forms 3
V Outlook Macro to show Flagged messages Outlook VBA and Custom Forms 2
J Help Please!!! Outlook 2016 - VBA Macro for replying with attachment in meeting invite Outlook VBA and Custom Forms 9
S Macro using .SendUsingAccount only works the first time, after starting Outlook Outlook VBA and Custom Forms 4
M Slow VBA macro in Outlook Outlook VBA and Custom Forms 5
A Forward Outlook Email by Filtering using Macro Rule Outlook VBA and Custom Forms 44
Tanja Östrand Outlook 2016 - Create Macro button to add text in Subject Outlook VBA and Custom Forms 1
D Outlook macro with today's date in subject and paste clipboard in body Outlook VBA and Custom Forms 1
C Outlook Subject Line Macro Outlook VBA and Custom Forms 0
D Macro sending outlook template from Excel list Outlook VBA and Custom Forms 6
P Macro to attach a file in a shared Outlook draft folder Outlook VBA and Custom Forms 2
R Macro to check file name with outlook address book Outlook VBA and Custom Forms 0
Diane Poremsky Use a macro to copy data in Outlook email to Excel workbook Using Outlook 0
W macro to export outlook emails to excel Outlook VBA and Custom Forms 6
J Outlook Macro to Update Sharepoint Excel File Using Outlook 1
Patrick van Berkel Best way to share (and keep up-to-date) Macro's in Outlook 2010 Outlook VBA and Custom Forms 6
C Newbie needs help with Outlook Macro Outlook VBA and Custom Forms 3
L Outlook 2007 - Macro Re Search Using Outlook 16
A newb outlook macro help Outlook VBA and Custom Forms 1
Diane Poremsky Macro to Bulk Import Contacts and vCards into Outlook Using Outlook 0
S Outlook 7 VBA macro for multiple filing Outlook VBA and Custom Forms 1
S Macro in an excel for outlook. Outlook VBA and Custom Forms 2
A Outlook Macro Causing Excel Error Outlook VBA and Custom Forms 0
Diane Poremsky Use a macro to copy data in Outlook email to Excel workbook Using Outlook 0
S Outlook Macro Reply to a message Outlook VBA and Custom Forms 1
Diane Poremsky Macro to Bulk Import vCards into Outlook Using Outlook 0
M Outlook VBA Macro that could retrieve/display the (From, Subject, Date Received) Outlook VBA and Custom Forms 2
Philip Rose Recreating a WORD Editing Macro to use in Outlook VBA Outlook VBA and Custom Forms 4

Similar threads

Back
Top