AutoExec Macro for an .oft file?

J

Jack G

I'd like to be able to start a new email message using an Office Form
Template (.oft), and have it programatically insert the contents of the
clipboard into the message section of the email as soon as it's opened. Can
the template support an AutoExec macro or something like that to accomplish
this?

The bigger picture is that I'm starting this email from within Access where
I've just saved what I want in the message to the Windows Clipboard. I'm
resorting to this method because I'm wanting the email in HTML format, and
the Access SendObject method only seems to support Plain Text.

Anyone have any ideas?

JackG
 
E

Eric Legault [MVP - Outlook]

You need to use VBScript behind your .oft form to interact with the message
body. Unfortunately, there is no direct way to access the Windows clipboard
with VBScript. You'd need to do things as a workaround:

- create a macro in your Outlook VBA project that uses the
MSForms.DataObject (see http://www.cpearson.com/Excel/clipboar.htm for
details)
- call this macro from your Item_Open() function in the code behind the .oft
form (see http://support.microsoft.com/?kbid=221827 for more info)

Otherwise, perhaps you can abandon using SendObject from Access and just
automate Outlook directly to obtain full control over the e-mail you are
creating:

Automating Outlook from other Microsoft Office applications:
http://msdn.microsoft.com/library/e...tOfficeApplications_HV05273034.asp?frame=true
 
S

Sue Mosher [MVP-Outlook]

..oft files don't run code unless the Exchange administrator expressly allows that, which is very, very unlikely.

A published form is needed to run code.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
E

Eric Legault [MVP - Outlook]

D'oh! Funny, because I thought that right away when I read his post, but for
some reason I was thinking it's fine if you run the .oft from the file system
rather than an .oft received through e-mail. It's the same darn thing of
course.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration and
SharePoint Infrastructure)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/
 

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