Button To Open Template - Outlook 2003
Thanks.
i really found several examples.
This is my compilation:
-------------------------------------------
Option Explicit
Public WithEvents oCBBCustom As Office.CommandBarButton
Private Sub Application_Startup()
Dim oCB As Office.CommandBar
Dim oCBBTools As Office.CommandBarPopup
Set oCB = Application.ActiveExplorer.CommandBars("Standard")
oCB.Reset
Set oCBBCustom = oCB.Controls.Add(msoControlButton, 1, ,
oCB.Controls.Count, True)
With oCBBCustom
.TooltipText = "my_Button"
.BeginGroup = True
.Style = msoButtonIcon
.Picture = LoadPicture("c:\k.bmp")
.Enabled = True
.Visible = True
End With
End Sub
Private Sub oCBBCustom_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
Dim newItem As Variant
Set newItem = Application.CreateItemFromTemplate("c:\wywo\MyForm .oft")
newItem.Display
Set newItem = Nothing
End Sub
-------------------------------------------
And it works fine on machine where I added this code manually in Visual
Basic Editor.
But I wonder what is the best way to distribute this on a several machines?
I need installation to be silent.
If copying of VbaProject.OTM is a best way to do this?
When i copy this file my script doesn't work and I have to copy outcmd.dat
as well.
|