Outlook 2007 Open Folder From a Contact

Status
Not open for further replies.

LMS

Senior Member
Outlook version
Outlook 2007
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.
 

LMS

Senior Member
Outlook version
Outlook 2007
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.
Just to be clear, when I open a contact from a calendar event the macros to do work as to the contact.
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
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
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
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
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
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?
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
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?
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
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.
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
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
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
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
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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. )
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
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
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
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
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
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.
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
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.
Thread starter Similar threads 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
M Outlook 2007 "cannot open your default email folders.microsoft exchange is not available" on XP is n Using Outlook 1
R Outlook 2007 cannot open files to start program Using Outlook 1
G Problem: MS Outlook 2007 will not open. Error with file c:/ Using Outlook 2
M My outlook 2007 will not open, it just gets stuck and my computer crashes. Using Outlook 1
G I can't open a URL link in from my email- Using Outlook 2007-Vista- AVG anti-virus Using Outlook 1
M Cannot open Outlook 2007 receive several different error messages such as Outlook has not been insta Using Outlook 1
R Can't open attachments, forward, or reply in Outlook 2007, XP Pro. Using Outlook 1
M Outlook 2007 - Contact detail won't open Using Outlook 2
S Cannot reply, reply all or forward an open mail in Outlook 2007 Using Outlook 1
L MSOffice 2007 Outlook functions normal, but crashes on specific email's when a reading pane is open. Using Outlook 7
M Can't open a link within email using outlook 2003. My laptop is windows office 2007. Using Outlook 1
W message appear while outlook 2007 is open ask about a password Using Outlook 3
S unable to open outlook 2007 Using Outlook 2
T Outlook 2007 takes a long time to open Excel 2002 attachments__ Using Outlook 2
C After closing Outlook 2007 the outlook.exe process remains open till I shutdown my computer ? Using Outlook 5
S Outlook 2007 always asks for exchange credentials when I first open it. Using Outlook 1
D Can I open an Outlook 2010 pst file in Outlook 2003 or Outlook 2007? Using Outlook 4
T Outlook 2007: Cannot open links in received emails. Get error message of "The operation has been c Using Outlook 1
J Cannot start microsoft outlook 2007. Cannot open the Outlook. Get error code. Using Outlook 3
S Outlook 2007 linked to MSN live mail freezes Outlook when I try to open the calendar. Using Outlook 4
C MS Office Outlook 2007 refuses to open. Using Outlook 2
L Cannot open microsoft office outlook 2007.__ Using Outlook 8
S Outlook 2007 not responding on open saying there are 30 messages receiving but they are not on the server Using Outlook 2
E My Outlook 2007 keeps crashing (actually refuses to open completely) and giving me this error messag Using Outlook 3
K Outlook 2007 When I attempt to open a new email, it won't open and says 'not responding' Using Outlook 5
B Open Outlook 2007 to find .ost file not available Using Outlook 3
P Outlook 2007 can't open calendar file (.vcs) Using Outlook 8
R outlook 2007 will not open Using Outlook 3
N File Open Fixs for Outlook 2007 reverted by MS updates... Using Outlook 1
L Outlook 2007 won't open unless i restart my computer. Using Outlook 1
R Re: Outlook 2007 startes to open and closes immediatatly Using Outlook 1
H Outlook 2007 was working fine and now won't open. Using Outlook 2
G Can't open email on Microsoft Outlook 2007 that contain java script Using Outlook 1
J I can't open any links from my Microsoft Outlook 2007 e-mails. Please help me. Using Outlook 3
S Re: Outlook 2007 won't re-open once closed Using Outlook 1
T Unable to open outlook a second time unless I reboot computer. Running XP and microsoft 2007 Using Outlook 6
G Outlook 2007 send tasks that can't be open by receiver Using Outlook 5
I CAN'T OPEN MY CONTACTS OR MY CALENDAR IN MS OUTLOOK 2007!!! Using Outlook 1
D Outlook 2007 won't open without granting access to the program. Using Outlook 5
P Impossible to open my Inbox in Outlook 2007 Using Outlook 1
V Scanpst reports no errors in PST file, but Outlook 2007 won't open, reports errors. Using Outlook 2
S Cannot open Outlook 2007 Using Outlook 1
P Outlook 2007 - Crashes when I try to open my calendar Using Outlook 1
Similar threads


















































Top