Outlook 2007 Macro to Run a Script From a Contact Form

Status
Not open for further replies.

LMS

Senior Member
Outlook version
Email Account
Exchange Server
I have some codes in my script of the Contact form I created that does some things. Is there a macro that I can create in Module that refers to the specific code in the script and runs it when I run the macro?

Or also, is there a code I put in the Outlook Session area that runs the script code in from a form of the Contact?
 
And the script code is run from a commandbutton in the contact form.....so is there a macro that identifies the form of the form of the contact, and runs the commandbutton?
 
to call script in the contact form, you need to use a public macro and call it by name - but this only works for useforms. The simple script in "Run Script" form can't be called from outside if i recall correctly. It's kicked off by events, so you could use vba to kick off the event.
 
In the past, you gave me the code that creates an email to the contact that is not opened but I highlight the contact. So is there a macro that when I highlight the contact but not open the contact, and then the macro runs a script code that is in the contact I highlight? As the script code only runs if I open the contact and click on a certain commandbutton.
 
The macros in the View Script (not Run Script, sorry) are not accessible from VBA - they need to be called by actions. You could use a property change (or custom property change) to trigger something. See http://support.microsoft.com/kb/180857/en-us for samples.

Basically, you'd add a custom field top the form, a simple checkbox should work, and use VBA to change it. When it changes, the custom property change is triggered and it triggers whatever you wanted to run. But I'm not sure if the events work with selections or if the form needs to be opened.
 
Thanks very much....that area won't do it....but, the script code in the contact is run in the contact by a commandbutton.....so do we have macro that identifies the name of the commandbutton in a contact, I select the contact and not open it up, and the macro then effectively clicks that commandbutton?
 
any update re the above...as I seems to me that there should be an simple macro that identifies the commandbutton in a contact, I select the contact and not open it up, and the macro then effectively clicks that commandbutton?
 
No updates today, had a server go down and spent all day in the server room. :( The problem is the commandbutton code is not exposed outside of the form... that makes it difficult for outlook's VBA to find it.
 
Got it! However, the code and related commandbutton click are in the form of the contact. So is there a way to run the click somehow from referring to the form and when I highlight the contact? Or anyother way?
 
I received the following VBA code from someone but it's not clear to me what to put in it etc.......I assume there is a Private Sub Name () and an End Sub words...but don't know what to replace re his words areas.....my Contact Form 1 (which you helped me create!!) is in the Personal FormsLibrary ...and don' know what Required Input Control Name means? Any answers please as I just need to the full code to copy and paste it and run it

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
 
You'd either put it in a sub and call it using your code or put it in your code where you want to call it up.
 
Thanks. I don't understand what you said. Can give me the details of what to do please ;)
 
Decide where you want to bring up the code - probably right before you do whatever with the selected contact, and add the lines.

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

library name is where it's stored - what you see in the Look in box in the choose forms dialog (i'm not sure if you need the folder name - I've never used the library in code). Use the display name (again, from the choose forms dialog) in the other fields and the name of the control you want to select.

*Because you are in contacts already, you should only need the entry in the lookin box.
 
Here are the words I have found, so please put them where they need to be as I have no idea what to do still The Contact Form 1 is in the Personal Forms Library of choosing a form......the commandbutton name is CommandButton4 ....and what do I put at the top and bottom re Sub?
 
It's my deadline day and I'm still working on the deadline. :( So no update today. Sorry.
 
Put this at the top of the macro that you are are using to call the form

Load ["Personal Forms Library"].Forms("Contact Form 1")
With Forms("Contact Form 1")
.[Command Button].Value = Selection
.CommandButton4_Click
End With

this at the end before end sub.
Forms("Contact Form 1").Unload

If you just need to call the macro in the form, and are doing anything else with it, then just wrap it with Sub / end sub.
 
Thanks very much.....what macro to use to call the form? Not sure what to do...sorry.....the code in the script of the contact form is the thing I want to make happen on the contact I select.....any thoughts 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
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 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

Similar threads

Back
Top