Outlook 2007 Macro to Run a Script From a Contact Form

Status
Not open for further replies.

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
if you are just calling that macro alone, not anything else, you'll use

sub callmymacro()

Load ["Personal Forms Library"].Forms("Contact Form 1")
With Forms("Contact Form 1")

' this wouldn't be command button - it would be whatever the command is that holds the selection value
.[Command Button].Value = Selection
.CommandButton4_Click
End With
Forms("Contact Form 1").Unload

end sub

I've never called a macro in a form without actually using the form, so I'm not really sure how it works.
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
did it and the error is "external name not defined" and it colors the words ["Personal Forms Library"]
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
So I have the code in front of me...

Code:
Load [LibraryName].Forms("Contact Form 1")
With Forms("Contact Form 1")
.[Required Input Control Name].Value = Selection
.CommandButton1_Click
End With
Forms("Contact Form 1").Unload

your error says the form name is wrong. But I don't know what the library name should be, if personal forms library doesn't work.
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Is there a pathway to the form?....as in past, as to email templates, we identified them from the pathway to the templates
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
No, not that I know of. If you are creating a new item, you can call it by name - "ipm.contact.contact form 1" - you don't need a path to it.
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
not a new item....thought there might be another way to identify it to load it....any other way perhaps?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
No, sorry, I don't. I can't find any thing in Google that references using the forms library either.
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
To follow up one more time, below is the script in the contact form that creates a calendar event for the contact I open. And if it just makes sense to create a new macro based the script I gave you, then when I run the macro after selecting a contact but not opening it, it creates the calendar event based the fields in the Contact.

 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
The script is too long to post, so ihave emailed it to you
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
I did it and the error is "object required" and the following line is colored yellow..
ContactName = Item.GetInspector.ModifiedFormPages("General").Controls("Fullname").value
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
That error says it can't find the fullname control - the code is looking for the control on the open contact form. Is the contact form open?
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
What form are you referring to please? I want this to run against a contact I select but not open
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
The form is this form: Item.GetInspector.ModifiedFormPages("General").Con trols("Fullname").value

the line needs to be after you set item, not first in the macro. You also need to dim item as the inspector.

If that is the standard fullname control, you can use the standard methods -

Set objcontact = session.ActiveInspector.CurrentItem

contactname = objcontact.FullName
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Thanks much. As I repeat offen, I don't understand all areas and earlier you emailed me the full code with your fixes. Can you possible do that, I wiil select the contact and run the macro and see if it sets the contact calender event. Thanks very very much!!
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Update today from the Smart Woman??
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
It's Thursday - deadline day. As soon as I get that done, I'll take a look.
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Thank you very much. Look forward to get this done.
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Any possible update this weekend please?
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
S Macro for other actions - Outlook 2007 Outlook VBA and Custom Forms 23
L Outlook 2007 - Macro Re Search Using Outlook 16
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 Reply to E-mail Using Outlook 16
L Outlook 2007 Macro Search Contacts Using Outlook 9
L Outlook 2007 Macro to LinkedIn Using Outlook 3
L Outlook 2007 Macro Open Contact Folder Using Outlook 7
L Macro to Open a Specific Word Document - Outlook 2007 Using Outlook 17
L Outlook 2007 Macro For Views Using Outlook 10
L Outlook 2007 Macro to Add Text to a Contact Field Using Outlook 10
F Help with Outlook 2007 Macro Please! Using Outlook 4
D outlook 2003/2007 macro query Using Outlook 2
L Outlook 2007 Macro to Email Field Using Outlook 31
O Macro for creating hyperlinks in Outlook 2007 Using Outlook 3
S Outlook 2007 Macro for replying to an e-mail. Outlook VBA and Custom Forms 1
J Can't run macro Outlook 2007 that was created in Word 2007 Outlook VBA and Custom Forms 1
I Creating an Outlook 2007 macro that attaches a signature to new me Outlook VBA and Custom Forms 1
L Help for writing an Outlook 2007 macro Outlook VBA and Custom Forms 7
D Insert Text via Macro in Outlook 2007 Outlook VBA and Custom Forms 2
G Outlook 2007 Macro: Paste - Paste Special - Unformatted Text Outlook VBA and Custom Forms 9
C After Office 2007 SP2 install - Outlook 2007 macro no longer worki Outlook VBA and Custom Forms 11
R Anyone have a sample macro for Outlook 2007 (setting the zoom)? Outlook VBA and Custom Forms 1
S Outlook 2007: automating form with macro Outlook VBA and Custom Forms 2
S How to create a macro to insert a signature in Outlook 2007 Outlook VBA and Custom Forms 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 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

Similar threads

Top