Using a custom outlook form in Excel

  • Thread starter Thread starter Timo Vortmeyer
  • Start date Start date
T

Timo Vortmeyer

Hi!
I'd like to know how I can use a custom designed form in Excel. Do I
have to publish in in outlook before I can use it in Excel? And what
is the syntax in Excel VBA to use it?
Thanks...
 
Whether the form needs to be published depends in large part on what it does
and for whom, but it probably does.

To create a new instance of a published custom form programmatically, use
the Add method on the target folder's Items collection. If it's a message
form, you can use the Drafts folder as the target. If the target is a
default folder, you can use the Namespace.GetDefaultFolder method to return
it as a MAPIFolder object. Otherwise, you can use the code at
http://www.outlookcode.com/d/code/getfolder.htm to walk the folder hierarchy
and return the MAPIFolder corresponding to a given path string.
 
Well, the forms is designed so that the .Subject and the .To fields
are disabled.
The link you posted can't help me to open the form in Excel.
This is the code to open an original mail form:
....
Dim OutLookJob As Object, mymail As Object
Set OutLookJob = CreateObject("Outlook.Application")
Set mymail = OutLookJob.CreateItem(0)
With mymail
.To = "(e-mail address removed)"
.Subject = "Dies ist deine Betreffzeile!"
.attachments.Add "C:\test.xls"
.display
....
I think that i have to change the CreateItem-Method to open the form,
but I don't know how...
 
I found the answer:

Dim OutLookJob As Object, mymail As Object
Set OutLookJob = CreateObject("Outlook.Application")
Set mymail = OutLookJob.CreateItemFromTemplate("J:\RÜCKMELDUNG.oft")
'*.Msg, *Oft

With mymail
.To = "(e-mail address removed)"
.Subject = "Dies ist deine Betreffzeile!"
.display
End With

It is not necessary to publish the form (what a luck... I had to do
that for 800 people...)
 
Back
Top