OUtlook VBScript Custom Form

J

Jason

Hi, Please can you help,

I'm programmming in VBA in Access 2003 and I want to create an outlook2003
mailitem containing a hyperlink that calls some VBscript within the form.

I've got three problems:
1. Getting any script in the form to run
2 Getting VBA to create an instance of the form
3. Getting the hyperlink to call the script
************************************************************
Problem 1
Using Outlook I can create a custom form containing VBScript. On the
properties tab I ticked the 'Send Form Definition with item' box. Then I
published the form in the personal forms library. I can see my custom form in
outlook when I do New>Choose Form... I can create a new item from this and it
works. However, when I send it to myself and open the received form, the
Item_Open event does not run any more.
************************************************************
Problem 2
My other problem is to create the message in VBA. Here are my three attempts.
Attempt 1
Save the form as an .oft. Then
Set Itm = myOlApp.CreateItemFromTemplate("C:\MyForm.oft")
Itm.HTMLBody = "<b><a href='file://D:/Test.txt'>This is a
hyperlink</a></b>"
Itm.Display

Now the created item looks OK but has no script in it and the hyperlink
doesn't work.
************************************************************
Attempt 2
Set Itm = myOlApp.CreateItem(olMailItem)
Itm.MessageClass = "IPM.Note.MyForm"
Itm.HTMLBody = "<b><a href='file://D:/Test.txt'>This is a
hyperlink</a></b>"
Itm.Display

It didn't work - It took no notice of the MessageClass line and just created
a MailItem
************************************************************
Attempt 3
Set myOlApp = CreateObject("Outlook.Application")
Set objFolder = myOlApp.ActiveExplorer.CurrentFolder
Set Itm = objFolder.Items.Add("IPM.Note.MyForm")
Itm.HTMLBody = "<b><a href='file://D:/Test.txt'>This is a
hyperlink</a></b>"
Itm.Display

It worked on one PC but not another (just created a MailItem)
************************************************************
Problem 3
I've only got as far as an href hyperlink. How do I write a hyperlink that
calls a VBScript function within the form?

Any ideas?
Thanks
Jason
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top