Outlook 2007 Open Folder From a Contact

Status
Not open for further replies.

LMS

Senior Member
Outlook version
Email Account
Exchange Server
In each Contact, whether it is in a subfolder, sub sub folder or sub sub sub folder, there is the normal field that shows the name of the folder that the contact is in.

When open the contact form the calendar event, it is the same, but many many marcos do work re the contact when it is opened from the calendar event.

So is there a macro you can give me, that when I open the contact, I run the macro opens up the folder that the contact is in from the field name of the folder in the contact...that way I can open the contact again very quickly and do what I need to do...and of course if the code opens up the folder and the contact, that would be even better....

Thanks so much as usual, as this is important again my timing etc.
 
In each Contact, whether it is in a subfolder, sub sub folder or sub sub sub folder, there is the normal field that shows the name of the folder that the contact is in.

When open the contact form the calendar event, it is the same, but many many marcos do work re the contact when it is opened from the calendar event.

So is there a macro you can give me, that when I open the contact, I run the macro opens up the folder that the contact is in from the field name of the folder in the contact...that way I can open the contact again very quickly and do what I need to do...and of course if the code opens up the folder and the contact, that would be even better....

Thanks so much as usual, as this is important again my timing etc.

Just to be clear, when I open a contact from a calendar event the macros to do work as to the contact.
 
Where in the contact is the folder path? As I have a code that opens up a folder or subfolder etc....so also as to this code, how can I say the last folder name name2 is the field words of the contact?

Public Sub OpenFolder()

Dim fldContacts As outlook.MAPIFolder

Set fldContacts = Session.GetDefaultFolder(olFolderContacts).Folders("Name").Folders("Name2")

fldContacts.Display

End Sub
 
This did it, but it asks to go to the folder, not just automatically open it...so what can we add on the display side that it just opens the folder?

And, can we add anything else that it opens the folder it opens the contact in the folder of the FullName from the Contact opened from the calendar?

Public Sub GetItemsFolderPath()
Dim obj As Object
Dim F As outlook.MAPIFolder
Dim Msg$
Set obj = Application.ActiveWindow
If TypeOf obj Is outlook.inspector Then
Set obj = obj.currentItem
Else
Set obj = obj.Selection(1)
End If
Set F = obj.Parent
Msg = "The path is: " & F.FolderPath & vbCrLf
Msg = Msg & "Switch to the folder?"
If MsgBox(Msg, vbYesNo) = vbYes Then
Set Application.ActiveExplorer.CurrentFolder = F

End If


End Sub
 
I found to delete the following: "If MsgBox(Msg, vbYesNo) = vbYes Then" and "End If", and it opens the folder automatically...so what can we add so it opens the same contact?
 
The folder may have many many contacts so I have to find it. Can we add to the code to open the contact autmatically?

As a thought, is there a code that searches just the folder and opens the contact?
 
I still don't understand what you're trying to achieve. You can open the appointment anytime, then double click the linked contact to open it.
 
When I open the contact from the calendar link, some macros for the contact do not work. So I need to open the contact from its folder
 
That sounds like the macros depend on the contact being the selected item, which'd be a weak design. What you want now, that is getting the contact from the Links collection, finding and activating its folder, then selecting the contact would be a lot of work. And then you'll probably realize that your calendar isn't the active folder anymore, and most likely you'll want to get back anyhow.

Instead of doing all this workarounds I'd suggest you modifiy the other macros. This demos how to work with an item, no matter whether it is the selected one in a folder, or the active open item. If no ContactItem is selected, it will leave the procedure without raising an error. You can incorporate this into the other macros so they can handle both situations:

dim c as contactitem
dim obj as object
if typeof application.activewindow is explorer then
if application.explorer.count then set obj=application.explorer.selection(1)
else
set obj=application.activeinspector.currentitem
endif
if not obj is nothing then
if typeof obj is contactitem then set c=obj
endif
if c is nothing then exit sub
 
The problem is that Outlook doesn't offer a way to select an item, only open it. You could try sending the contact name to find it.

This should work but I can't test it on my version of Outlook. You'd need to reopen the contact.

Code:
Public Sub GetItemsFolderPath()
Dim obj As Object
Dim F As Outlook.MAPIFolder
Dim txtSearch As String

Set obj = Application.ActiveWindow
If TypeOf obj Is Outlook.Inspector Then
Set obj = obj.currentItem
Else
Set obj = obj.Selection(1)
End If
Set F = obj.Parent
Set Application.ActiveExplorer.CurrentFolder = F

txtSearch = "fullname:" & obj.FullName
Application.ActiveExplorer.Search txtSearch, olSearchScopeCurrentFolder
 
End Sub

FWIW, provided you don't have contacts by the same name in different folders, you should be able to search all contact folders instead of looking up the specific folder.
http://www.slipstick.com/developer/instant-search-messages-selected-contact/


Hmm. Thought #2. I wonder if it would work to use - or something along the lines of closing it then finding it in the folder.
obj.Close olSave
obj.Display
 
If i recall correctly, using that code wasn't working for contacts opened from links. It's possible I'm thinking of something else... or it was specific to something else in the macro. (I don't have time right now to go through his other threads to find that discussion. )
 
Thanks. I'll check it out. :)
 
In addition to what we have looked into, the following code is an code that creates an email to a selected contact or open contact using one of my email templates...but if I open the contact from the link on the calendar event, it does not work...so what do we change so it works however I open the contact...and also, please show me what to put in and/or change and where...so I am done with it...thanks much

Sub EmailForm()
Dim objApp As Application
Dim objNS As NameSpace
Dim objFolder As MAPIFolder
Dim objMsg As mailItem
Dim objItem As Object

Set oContact = objItem
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")

Set objSelection = objApp.ActiveExplorer.Selection

For Each objItem In objSelection


Set objMsg = Application.CreateItemFromTemplate("C:\Users\UserName\AppData\Roaming\Microsoft\Templates\Emailform.oft")
With objMsg

.To = objItem.Email1Address & ";" & objItem.Email2Address

objMsg.Display

End With
'objMsg.Send
Next
Set objMsg = Nothing
Set objItem = Nothing
Set objFolder = Nothing
Set objNS = Nothing
Set objApp = Nothing
End Sub
 
And this code copies the name of the FullName field if I open up the contact from the folder or even the calendar event...but it does not work, if I click on the email address of the person that sends me the email and it opens up his contact, but his code does not work...so what to change here specifically please?

Sub CopyFullName()
Dim oContact As contactItem
'DataObj As MSForms.DataObject

Set oContact = ActiveExplorer().Selection.item(1)
Set DataObj = New MSForms.DataObject
DataObj.SetText oContact.fullname
DataObj.PutInClipboard
End Sub
 
The latter code is a very good example for you to get it done yourself. As you can read in the code, it refers to the one selected item. Incorporate my example, so it can handle both either the selected item, or the open item. And don't forget to rename my ContactItem variable by yours.
 
Please show me where to put your example in my code and how to do the rename. If you can, please just change my code so i can try it as I am not the technical expert. Thanks
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
Z Outlook 2007, clicking email addresses fails to open Contact Using Outlook 0
L Outlook 2007 Macro Open Contact Folder Using Outlook 7
S Pre populate subject + body + attachment to already open email in outlook 2007 Using Outlook 2
P Cannot open Options Menu Outlook 2007 and Cannot create a new profile Using Outlook 0
L Macro to Open a Specific Word Document - Outlook 2007 Using Outlook 17
P Calender in Outlook 2007 wont open Using Outlook 4
M open outlook contacts in access 2007 form Using Outlook 1
E Double clicking on from email address does no longer open corresponding contact in Outlook 2007 Using Outlook 7
X open specific e-mail messages in outlook 2007 c# Outlook VBA and Custom Forms 1
V I cannot open my outlook small business 2007 BCM (Business Contact Manager) 1
D Outlook 2007 Recovering E-Mails Using Outlook 0
W Transfer Outlook 2016 autocomplete file to Outlook 2007 Using Outlook 1
C Outlook 2007 Removing then adding account restores junk email processing Using Outlook 0
S Outlook 2007 crash linked to gdiplus.dll Using Outlook 0
S Outlook 2007 - Automatic purge fail Using Outlook 0
J outlook 2007 doesn't let me choose which .pst to search Using Outlook 2
D Outlook 2007 vs. Outlook 2010 -- ToDo Bar Using Outlook 0
D Outlook 2007 on 365 Using Outlook.com accounts in Outlook 2
S Macro for other actions - Outlook 2007 Outlook VBA and Custom Forms 23
S Verwendung von Outlook 2007 Using Outlook 0
A Arthur needs help with 2007 Outlook e-mail Using Outlook.com accounts in Outlook 3
M PST import from Outlook 2007 to 2010 - Address Book contacts all in 1 group Using Outlook 4
S outlook 2007 calendar search Using Outlook 6
B Migrate Outlook 2007 to Office 365 Using Outlook 3
X I have met my waterloo trying to resolve embedded graphics problem with outlook 2007 and now 2016 Using Outlook 1
R Outlook 2007 only loads some appointments Using Outlook 0
C Move Outlook 2007 to new PC with Outlook 365 Using Outlook 3
J Outlook 2007 Hide Messages Option not Available Using Outlook 2
S Outlook 2007 Calendar instant search problem. Windows 7 Using Outlook 4
S Outlook 2007 Calendar instant search problem. Windows 7 Using Outlook 0
B Server errors Outlook 2007 Using Outlook 1
S Reboot of frozen windows7 results in changed outlook 2007 settings Using Outlook 1
S Outlook 2007 printing wrong email address at top of page Using Outlook 8
M Configure outlook 2007 to accept digital signatures Using Outlook 2
D Outlook 2007 crashes when opening an email Using Outlook 2
R New chap saying hello and needing advice on Outlook 2007 thumbnails Using Outlook 3
icacream From Outlook 2007 to 2016 ! Using Outlook 9
vodkasoda Object could not be found Error in Outlook 2007 Outlook VBA and Custom Forms 5
S Outlook 2007: Address Cards allow entering text! Why? Using Outlook 3
S View Appointment in Text Wrap in Outlook 2007 Month Calendar View Using Outlook 0
L Outlook 2007 Separate the Send/Receive functions Using Outlook 2
M Outlook 2007 Contacts Glitch: Creating a new email Using Outlook 1
C Move from Outlook 2007 Enterprise (MOE) to Outlook Pro plus 2007 Using Outlook 1
J reinstalling Outlook 2007 asking for user name & password Using Outlook 14
P outlook addin unloaded in office 2007 Using Outlook 0
B Fonts in Outlook 2007 Using Outlook 4
R Add Exchange Account to existing POP3 Outlook 2007 Profile Using Outlook 0
C out of space in file group Outlook 2007 Using Outlook 2
A Moving archived contents in Outlook 2007 back into working folders Using Outlook 0
P Outlook 2007 Email Categorization using VBA Outlook VBA and Custom Forms 1

Similar threads

Back
Top