Macro Create Contact and Save

Status
Not open for further replies.

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
The following code creates a new contact from my form but it will not save and the error is that the parameter value is not valid....what can we do to fix this please?

Sub OpenMyContact()
Dim oContact As outlook.contactItem
Dim oFolder As outlook.MAPIFolder
Set oFolder = Application.Session.GetDefaultFolder(olFolderContacts)
Set oContact = oFolder.Items.Add("IPM.Contact.Contact Form 1.")
oContact.Display
End Sub
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
And I found this code that creates it and can save, but not related to my type of contact form I want to use...so, do we change this or the other?

Public Function StartOutLook()
On Error GoTo StartOutLook_Error
Dim spObj As Object, MyItem As Object
' Create a Microsoft OutLook object.
Set spObj = CreateObject("Outlook.Application")
' Create and open new contact form for input.
' You can substitute olAppointmentItem, olJournalItem, olMailItem,
' olNoteItem, olPostItem, or olTaskItem for olContactItem.
Set MyItem = spObj.CreateItem(olContactItem)
MyItem.Display
' Quit Microsoft Outlook.
Set spObj = Nothing
Exit Function
StartOutLook_Error:
MsgBox "Error: " & Err & " " & Error
Exit Function
End Function
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
To All If This Helps:

I just took the dot . after the number 1 off and it fixed it...so the first code works to my form

Set oContact = oFolder.Items.Add("IPM.Contact.Contact Form 1.")
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
L Macro Create Contact and Save Using Outlook 8
S Macro to create a new contact, 2 appointments, and a task Using Outlook 1
A Outlook macro to create search folder with mail categories as criteria Outlook VBA and Custom Forms 3
Tanja Östrand Outlook 2016 - Create Macro button to add text in Subject Outlook VBA and Custom Forms 1
B Macro To Create Rule To Export From Certain Folder Email Information in one workbook multiple sheets Outlook VBA and Custom Forms 0
A Create Macro for hyperlink(email) in message body Outlook VBA and Custom Forms 9
S Macro to create notification emails Using Outlook 1
N Macro to create task Using Outlook 1
S Macro to create a new folder with subject line as the folder name Using Outlook 2
P Please Help me Create a Macro ! Using Outlook 2
M How to Create Macro in Visual Basic to add Contacts from Personal Folder Using Outlook 4
R How do I create a macro to put text in certain emails? Outlook VBA and Custom Forms 1
D Create a macro in Outlook to run a rule Outlook VBA and Custom Forms 32
N How Can I create an Outlook Macro to import calendar? Outlook VBA and Custom Forms 1
P How do I create a macro to add contacts from email messages? Outlook VBA and Custom Forms 1
J Macro to create folder in PST file Outlook VBA and Custom Forms 4
G Macro: Create New Message and Auto populate To Field Outlook VBA and Custom Forms 5
S How to create a macro to insert a signature in Outlook 2007 Outlook VBA and Custom Forms 1
N Help creating a VBA macro with conditional formatting to change the font color of all external emails to red Outlook VBA and Custom Forms 5
S Visual indicator of a certain property or to show a macro toggle Outlook VBA and Custom Forms 2
L Modifying VBA script to delay running macro Outlook VBA and Custom Forms 3
S Macro to extract and modify links from emails Outlook VBA and Custom Forms 3
M Replyall macro with template and auto insert receptens Outlook VBA and Custom Forms 1
L Macro to add Date & Time etc to "drag to save" e-mails Outlook VBA and Custom Forms 8
S Macro for Loop through outlook unread emails Outlook VBA and Custom Forms 2
Globalforester ItemAdd Macro - multiple emails Outlook VBA and Custom Forms 3
S Macro to extract email addresses of recipients in current drafted email and put into clipboard Outlook VBA and Custom Forms 2
witzker HowTo start a macro with an Button in OL contact form Outlook VBA and Custom Forms 12
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
C Macro to extract sender name & subject line of incoming emails to single txt file Outlook VBA and Custom Forms 3
L Macro/VBA to Reply All, with the original attachments Outlook VBA and Custom Forms 2
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
Eike Move mails via macro triggered by the click of a button? Outlook VBA and Custom Forms 0
S Macro or plug-in to see if specific person was included in this email Outlook VBA and Custom Forms 4
U Macro for reminders,tasks,calendar Outlook VBA and Custom Forms 4
V macro runs slower on startup than after Outlook VBA and Custom Forms 3
N Macro to move all recipients to CC while replying Outlook VBA and Custom Forms 0
A VBA macro for 15 second loop in send and received just for 1 specific mailbox Outlook VBA and Custom Forms 1
G VBA Macro Calendar Printing Assistant 4
R Help Revising VBA macro to delete email over different time span 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
Healy Consultants Macro to remove inside organization distribution list email address when reply to all recepients Outlook VBA and Custom Forms 0
geofferyh Cannot get Macro to SAVE more than one message attachment??? Outlook VBA and Custom Forms 5
N How can I increase/faster outlook VBA Macro Speed ? Using Outlook 2
4 Macro to set the category of Deleted Item? Outlook VBA and Custom Forms 2

Similar threads

Top