Outlook Macro to Contact

Status
Not open for further replies.
Try the macro I posted earlier so you can get an idea of how it works. I don't think it's really want you want - a search macro that looks for the contact by name might be better.
 
Thank you very very much. As I repeat, i am not the expert and just do what you show me to do. Can you please post the full macro that i click on when I open a contact and please tell me where i see the entryid. As when I get it i can quickly create the macro that opens that contact and add it to the list of macros re the list of contacts I get in a combobox re the other macro you gave me in the past. Thank you again very very much.
 
I found the following macro that shows the entryid and storeid of an email and when I click highlight the email and run the macro, a text box opens up showing the info....

So what do we change to this that will do it for a contact please?

Public Sub GetEntryIDAndStoreIDOfCurrentEmail()
Dim Session As Outlook.NameSpace
Dim currentExplorer As Explorer
Dim Selection As Selection
Dim currentItem As Object
Dim currentMail As MailItem
Dim entryID As String

Set currentExplorer = Application.ActiveExplorer
Set Selection = currentExplorer.Selection

'for all items do...
For Each currentItem In Selection
If currentItem.Class = olMail Then
Set currentMail = currentItem
MsgBox "EntryID is " & currentMail.entryID & vbCrLf & vbCrLf & " Store ID is " & currentMail.Parent.StoreID
End If
Next


End Sub
 
I just changed it to the following and it does it for contact, but the textbox that opens up, you cannot copy the entryid...its just like a picture....is there anything to do so when it opens up the entryid, I can copy the entryid......this does it so far, just need to be able to copy it:

Public Sub GetEntryIDContact()
Dim Session As Outlook.NameSpace
Dim currentExplorer As Explorer
Dim Selection As Selection
Dim currentItem As Object
Dim currentContact As ContactItem
Dim entryID As String

Set currentExplorer = Application.ActiveExplorer
Set Selection = currentExplorer.Selection

'for all items do...
For Each currentItem In Selection
If currentItem.Class = olContact Then
Set currentContact = currentItem
MsgBox "EntryID is " & currentContact.entryID
End If
Next
 
Just found a way that when the msgBox is created, just do Ctrl + C and then paste it to a notepad using Ctrl + V....and that did it as it copies the words/numbers of the msgBox
 
One more important thing: I read how you can use a Userform TextBox to show what comes of the EntryId....so here is what I changed per what I read and it is not quite doing it yet...and my guess it the Smart Woman knows how to fix it right away!!! PS, underneath what I show is in addition the code I read re another situation re using a TextBox

Public Sub GetEntryIDContact1()
Dim Session As Outlook.NameSpace
Dim currentExplorer As Explorer
Dim Selection As Selection
Dim currentItem As Object
Dim currentContact As ContactItem
Dim entryID As String

Set currentExplorer = Application.ActiveExplorer
Set Selection = currentExplorer.Selection

'for all items do...
For Each currentItem In Selection
If currentItem.Class = olContact Then
Set currentContact = currentItem
msg = "EntryID is " & currentContact.entryID
With MsgUserForm
.TextBox1.Text = msg
.Show
End If

Next


End Sub

Sub MyMsg(msg As String)
With MsgUserForm ' this is the name I gave to the userform
.TextBox1.Text = msg
.Show
End With

End Sub
 
I have the following code that when I open a contact and run this macro, it shows the entryID of the contact in a MsgBox, and would like that to open up as a TextBox from a Userform. I have a Userform19 which has TextBox1, so what can we change here so that running the code opens up a textbox?

Public Sub GetEntryIDContact()
Dim Session As outlook.NameSpace
Dim currentExplorer As Explorer
Dim Selection As Selection
Dim currentItem As Object
Dim currentContact As ContactItem
Dim entryID As String

Set currentExplorer = Application.ActiveExplorer
Set Selection = currentExplorer.Selection

'for all items do...
For Each currentItem In Selection
If currentItem.Class = olContact Then
Set currentContact = currentItem
MsgBox "EntryID is " & currentContact.entryID
End If
Next


End Sub
 
I'll have to look up the exact code you need, but basically, you'd use something like

Textbox1.Text = currentContact.entryID

(It might be Value instead of Text)
 
I tried each of the following re that line and each time it does not do it and just shows the macro in the module with the line yellowed!!

Textbox1.Text = currentContact.entryID

Textbox1.Value = currentContact.entryID
 
Here is the update...I created the following and when I click on the macro the Userform Textbox shows up with nothing in it....and then I close it and click it a second time, and it shows the entryID!

But, why do I have to do it twice....and secondly, I can't copy and past using my mouse on the right side of the mouse, but can highlight all and use Ctrl + c

So can we fix the twice thing and be able to use the mouse to copy and past from it?

Public lstNum21 As Long

Public Sub GetEntryIDContact2()
UserForm19.Show
Dim Session As Outlook.NameSpace
Dim currentExplorer As Explorer
Dim Selection As Selection
Dim currentItem As Object
Dim currentContact As ContactItem
Dim entryID As String

Set currentExplorer = Application.ActiveExplorer
Set Selection = currentExplorer.Selection

'for all items do...
For Each currentItem In Selection
If currentItem.Class = olContact Then
Set currentContact = currentItem
entryID = currentContact.entryID
UserForm19.TextBox1.Value = currentContact.entryID
End If
Next


End Sub
 
I don't know. It's a beautiful day up here... :)
 
You really don't have a life, do you? LOL
 
i added a line to clear the entryid before getting it and it seems to work -

entryID = ""
'for all items do...
For Each currentItem In Selection

not sure why that should matter, but at least in my testing, it seems to make your code work the first time.
 
thanks....but it did not fix it for me...sorry.,..any other thoughts happy to hear...also, any other thoughts on the copy and past from the text box that shows the entryID
 
thanks....don't need it onthe clipboard....just copying it from the text box and pasting it into a macro to create the link to a contact.....thanks....

and nothing else re the entryid thing re starting the macro after I first click on it and it doesn't do it??
 
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