Home All Groups Group Topic Archive Search About
Author
30 Dec 2004 10:59 PM
GeorgeFD29
Hello.

I have done a lot of vba programming in excel.  I'm trying to apply what I
know from xl to outlook and am really stumped.  I added a command button to
the contact form.  In excel, I could just double click it and the vba
environment would open with the command button click event already started. 
Not so in Outlook. 

What I am trying to do, is add a command button to the contact form and
write vba code that would pass data in some of the contact form fields to
another application using ADO.  So the question is, how to "link" vba code to
the custom control and how to reference fields on the contact form.

Any help would really be appreciated!

Happy New Year,
George
Author
31 Dec 2004 1:38 PM
Sue Mosher [MVP-Outlook]
You don't, at least not directly. Custom Outlook forms run VBScript, not
VBA. For item-level events, you can use the Script | Event Handler command
to insert the shell for an event procedure. For Click event handlers, you
need to write your own:

    Sub CommandButton1_Click()
        MsgBox "You clicked CommandButton1"
    End Sub

Your VBScript form code can call a Public VBA procedure located in the
built-in ThisOutlookSession module as Application.my_procedure_name.

See http://www.outlookcode.com/d/propsyntax.htm for basics on Outlook
property syntax.
--
Sue Mosher, Outlook MVP
Author of
     Microsoft Outlook Programming - Jumpstart for
     Administrators, Power Users, and Developers
     http://www.outlookcode.com/jumpstart.aspx


Show quoteHide quote
"GeorgeFD29" <GeorgeF***@discussions.microsoft.com> wrote in message
news:4C6E1096-320B-4D05-A368-48B3D3AA4E6B@microsoft.com...
> Hello.
>
> I have done a lot of vba programming in excel.  I'm trying to apply what I
> know from xl to outlook and am really stumped.  I added a command button
> to
> the contact form.  In excel, I could just double click it and the vba
> environment would open with the command button click event already
> started.
> Not so in Outlook.
>
> What I am trying to do, is add a command button to the contact form and
> write vba code that would pass data in some of the contact form fields to
> another application using ADO.  So the question is, how to "link" vba code
> to
> the custom control and how to reference fields on the contact form.
>
> Any help would really be appreciated!
>
> Happy New Year,
> George
Are all your drivers up to date? click for free checkup

Author
31 Dec 2004 1:56 PM
Ken Slovak
Outlook forms do not use VBA, they use VBScript and the code is embedded in
the form definition. It becomes accessible to users after you publish the
custom form. In the form code you would have a procedure something like this
for a button named cmdClicker:

Sub CmdClicker_Click()

See http://www.outlookcode.com/d/formcontrols.htm for lots of information to
get you started programming Outlook forms.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


Show quoteHide quote
"GeorgeFD29" <GeorgeF***@discussions.microsoft.com> wrote in message
news:4C6E1096-320B-4D05-A368-48B3D3AA4E6B@microsoft.com...
> Hello.
>
> I have done a lot of vba programming in excel.  I'm trying to apply what I
> know from xl to outlook and am really stumped.  I added a command button
> to
> the contact form.  In excel, I could just double click it and the vba
> environment would open with the command button click event already
> started.
> Not so in Outlook.
>
> What I am trying to do, is add a command button to the contact form and
> write vba code that would pass data in some of the contact form fields to
> another application using ADO.  So the question is, how to "link" vba code
> to
> the custom control and how to reference fields on the contact form.
>
> Any help would really be appreciated!
>
> Happy New Year,
> George

Bookmark and Share