PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Excel script to populate form fields

Reply

Excel script to populate form fields

 
Thread Tools Rate Thread
Old 03-08-2004, 09:19 PM   #1
=?Utf-8?B?VUtOZXdiaWU=?=
Guest
 
Posts: n/a
Default Excel script to populate form fields


Hi,

I am trying to create an Excel script that will launch an e-mail and populate the fields with the values of specific cells. My knowledge of the Outlook object model, let alone my rudimentary knowledge of VBA is letting me down.

So far, I have the following to launch the e-mail but now I'm a little stuck: -
-----------------------------------------------------------------------
Sub CommandButton1_Click()

Dim ol As Outlook.Application
Dim itm As Object

Set ol = New Outlook.Application
Set itm = ol.CreateItemFromTemplate _
("C:\Documents and Settings\Mike\Desktop\Test.oft")

With itm
.To = "mike_pe@hotmail.com"
.Subject = "Test"
.Display
End With

Set itm = Nothing
Set ol = Nothing

End Sub
-----------------------------------------------------------------------
I need to be able to reference the UserProperties of the form Items and specify the values of those fields.

Can anyone shed a little light, please? Your help, as always, would be most appreciated.

Mike.
  Reply With Quote
Old 03-08-2004, 11:38 PM   #2
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: Excel script to populate form fields

itm.UserProperties("My Custom FIeld") -- see
http://www.outlookcode.com/d/propsyntax.htm for more information 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


"UKNewbie" <UKNewbie@discussions.microsoft.com> wrote in message
news:A5F2E5CB-C4EC-415C-AAF0-A396AE15BC57@microsoft.com...
> Hi,
>
> I am trying to create an Excel script that will launch an e-mail and

populate the fields with the values of specific cells. My knowledge of the
Outlook object model, let alone my rudimentary knowledge of VBA is letting
me down.
>
> So far, I have the following to launch the e-mail but now I'm a little

stuck: -
> -----------------------------------------------------------------------
> Sub CommandButton1_Click()
>
> Dim ol As Outlook.Application
> Dim itm As Object
>
> Set ol = New Outlook.Application
> Set itm = ol.CreateItemFromTemplate _
> ("C:\Documents and Settings\Mike\Desktop\Test.oft")
>
> With itm
> .To = "mike_pe@hotmail.com"
> .Subject = "Test"
> .Display
> End With
>
> Set itm = Nothing
> Set ol = Nothing
>
> End Sub
> -----------------------------------------------------------------------
> I need to be able to reference the UserProperties of the form Items and

specify the values of those fields.
>
> Can anyone shed a little light, please? Your help, as always, would be

most appreciated.
>
> Mike.



  Reply With Quote
Old 04-08-2004, 04:49 PM   #3
=?Utf-8?B?VUtOZXdiaWU=?=
Guest
 
Posts: n/a
Default Re: Excel script to populate form fields

Sue,

Yet again, you've saved my bacon. I would buy you a drink if I could.

I don't very often take advantage of "with" statements and, along with your info below, I'm now able to populate an update e-mail with exactly the data required for distribution, entirely from within an excel spreadsheet (which gathers info from 3rd party software).

Many thanks as ever,

Mike.

"Sue Mosher [MVP-Outlook]" wrote:

> itm.UserProperties("My Custom FIeld") -- see
> http://www.outlookcode.com/d/propsyntax.htm for more information 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
>
>
> "UKNewbie" <UKNewbie@discussions.microsoft.com> wrote in message
> news:A5F2E5CB-C4EC-415C-AAF0-A396AE15BC57@microsoft.com...
> > Hi,
> >
> > I am trying to create an Excel script that will launch an e-mail and

> populate the fields with the values of specific cells. My knowledge of the
> Outlook object model, let alone my rudimentary knowledge of VBA is letting
> me down.
> >
> > So far, I have the following to launch the e-mail but now I'm a little

> stuck: -
> > -----------------------------------------------------------------------
> > Sub CommandButton1_Click()
> >
> > Dim ol As Outlook.Application
> > Dim itm As Object
> >
> > Set ol = New Outlook.Application
> > Set itm = ol.CreateItemFromTemplate _
> > ("C:\Documents and Settings\Mike\Desktop\Test.oft")
> >
> > With itm
> > .To = "mike_pe@hotmail.com"
> > .Subject = "Test"
> > .Display
> > End With
> >
> > Set itm = Nothing
> > Set ol = Nothing
> >
> > End Sub
> > -----------------------------------------------------------------------
> > I need to be able to reference the UserProperties of the form Items and

> specify the values of those fields.
> >
> > Can anyone shed a little light, please? Your help, as always, would be

> most appreciated.
> >
> > Mike.

>
>
>

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off