Button To Open Template - Outlook 2007

G

garfong

I need to create a button on the toolbar that will open a template stored in
the office\templates directory. I tried creating a button that hyperlinked to
the template but Outlook has decided such a move is dangerous and once the
user gets past all the warnings, the template comes up blank because outlook
has blocked all the functionality.

Any ideas how I can use VBA to get past the annoying prompts and get the
button to open the template directly? In effect, the button would recreate
the steps of going to File > New > Choose Form > Look In: User Templates In
File System > Open test.otf
 
S

Sue Mosher [MVP-Outlook]

Write a macro that calls the Application.CreateItemFromTemplate method:

Sub MakeItem()
Set newItem = Application.CreateItemFromTemplate("c:\your path\open test.oft")
newItem.Display
Set newItem = Nothing
End Sub
 
W

Walter

Here is a very simple solution:
1)Customize menu (right click in menu bar)
2)click en "rearrange commands"
3)Select any menu bar (may be you can create a new one)
4)Add a button.
5)click in "modify selection"
6)Edit Hyperlink
7)choose existing file and select your .oft file.

I hope this help you.
See you.
 
P

PeterHS

Is this also possible to do this with forms i published? The last 4 hours I
tried to put "olformregistry" and "olorganizationregistry" in the command,
but I can't get it to work.

Or as a alternative to open the dialog with standard the public forms?

Or are i'm searching for something that is imposible. What I want is for
users to "with one button to choose from I list off published forms for
sending e-mail".

Manny thanks

Peter
 
S

Sue Mosher [MVP-Outlook]

To create a new instance of a custom form programmatically, use the Add method on the target folder's Items collection:

Set newItem = targetFolder.Items.Add("IPM.Post.YourFormName")

If it's a message form, 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. To create an item in another person's mailbox, use Namespace.GetSharedDefaultFolder to get the MAPIFolder 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.

See http://www.outlookcode.com/article.aspx?id=56 for other ideas.

BTW, using a published custom form to send messages outside an Exchange organization can cause problems with attachments for the recipients.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
Joined
May 9, 2008
Messages
1
Reaction score
0
Sorry to be thick - I managed to create the VBA and run it interatively, but which template do I save it in, and how do I then link the button to it, so that it is available all the time.

Is there a way of 'intercepting' the New mail functionality (I am sure in the 'old' days with Word VBA you could call a macro in a global .dot FileNew and then whenever the user chose tha option they got the macro rather than the code - is there an equivalent technique in Outlook 2007 so that whenever they ask for a new email they got the .oft that I want them to have?)

Christine
 
Joined
May 5, 2009
Messages
3
Reaction score
0
WOW I really hope you can help Sue...

You're suggestion work great for me. However, i would really like to make this available to multiple users... about 20.

How can i share this macro accross the board with my users without doing this manual process each time per user?

Please and thanks


Sue Mosher [MVP-Outlook] said:
Write a macro that calls the Application.CreateItemFromTemplate method:

Sub MakeItem()
Set newItem = Application.CreateItemFromTemplate("c:\your path\open test.oft")
newItem.Display
Set newItem = Nothing
End Sub

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"garfong" wrote in message news:[email protected]...
>I need to create a button on the toolbar that will open a template stored in
> the office\templates directory. I tried creating a button that hyperlinked to
> the template but Outlook has decided such a move is dangerous and once the
> user gets past all the warnings, the template comes up blank because outlook
> has blocked all the functionality.
>
> Any ideas how I can use VBA to get past the annoying prompts and get the
> button to open the template directly? In effect, the button would recreate
> the steps of going to File > New > Choose Form > Look In: User Templates In
> File System > Open test.otf
 
Joined
Feb 14, 2011
Messages
2
Reaction score
0
Hi Sue,
Sorry to post in such an old thread but I was wondering if it is possible to create a custom button that pulls up a form that is published in the personal forms library?

Thanks
 
Joined
May 5, 2009
Messages
3
Reaction score
0
Hey Javucosta. try this.

Sub Your macro name()

strForm = "IPM.Note.Your Form name"
Set objFolder = _
Application.ActiveExplorer.CurrentFolder
Set objItem = _
objFolder.Items.Add(strForm)
objItem.Display


End Sub

do you know how to create a macro in Outlook?
 
Joined
Feb 14, 2011
Messages
2
Reaction score
0
Hi Rexmero
Thanks for the reply. I ended up using a windows shortcut to the published form in the users' personal forms library. I basically used the shortcut:

"C:\Program Files (x86)\Microsoft Office\Office12\OUTLOOK.EXE" /c "IPM.Note.MyForm"

Works like a charm

Thanks again
 
Joined
May 30, 2007
Messages
2
Reaction score
0
Hi,

I am struggling modifying Sue's code 'reply with attachments'. I am not concerned about attachments. I would just like to reply to an existing email using a "canned" .msg response email. I currently have button macros that call a .msg file and it they work great except for capturing the current email body and reply to addresses. I am not able to to take the current email and insert my .msg file into the 'reply' email. I would also like to reply 'all' vs. just the "From:" respondent.

Here is her code:
http://www.outlookcode.com/codedetail.aspx?id=1228

Instead of attaching my 'gookie" code that isn't working, I have placed my working code. So can you give me some direction on how to make this work? Also, not sure if there is an issue using .msg files vs. oft. files?

*****************************************************
Message_Macros
*****************************************************
Sub eClerk_vs_Email()
Set myOlApp = CreateObject("Outlook.Application")
Set MyItem = myOlApp.CreateItemFromTemplate("\\srvdesktop1\pctemp$\Email_Templates\eClerk\eClerk vs Email.msg")
MyItem.Display

End Sub
Sub eClerk()
Set myOlApp = CreateObject("Outlook.Application")
Set MyItem = myOlApp.CreateItemFromTemplate("\\srvdesktop1\pctemp$\Email_Templates\eClerk\eClerk.msg")


*****************************************************
Buttons
*****************************************************
Private Sub Application_Startup()
Dim Mybar As CommandBar
Dim MyButton
On Error Resume Next
Application.ActiveExplorer.CommandBars("Menu Bar").Controls("&ITS Templates").Delete
With Application.ActiveExplorer.CommandBars("Menu Bar")
Set MyButton = .Controls.Add(Type:=msoControlPopup, Before:=8)
MyButton.Caption = "&ITS Templates"
MyButton.Visible = True
End With

'**************************************************************************************************
With Application.ActiveExplorer.CommandBars("Menu Bar").Controls("&ITS Templates").Controls
Set objCBPop = .Add(Type:=msoControlPopup)
With objCBPop
.BeginGroup = True
.Caption = "eClerk"
Set objCBSub = objCBPop.CommandBar
End With
With objCBSub.Controls
Set objCBB = .Add(Type:=msoControlButton)
With objCBB
.Caption = "eClerk vs. Email"
.OnAction = "eClerk_vs_Email"
.Style = msoButtonIconAndWrapCaption
End With

Set objCBB = .Add(Type:=msoControlButton)
With objCBB
.Caption = "eClerk"
.OnAction = "eClerk"
.Style = msoButtonIconAndWrapCaption
End With

End Sub
 

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