Insert File Problem

G

Guneet

How can I have outlook(2003) set up so that everytime I click on New( Compose
a mail), insert file window opens automatically with it?
Thanks
 
M

Michael Bauer [MVP - Outlook]

You can do that with VBA, but it's a little bit tricky. Open the VBA
environment and copy this code into the module called "ThisOutlookSession":

Private WithEvents m_Inspectors As Outlook.Inspectors
Private WithEvents m_Inspector As Outlook.Inspector

Private Sub Application_Startup()
Set m_Inspectors = Application.Inspectors
End Sub

Private Sub m_Inspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
Dim Mail As Outlook.MailItem
Dim obj As Object

Set obj = Inspector.CurrentItem
If TypeOf obj Is Outlook.MailItem Then
Set Mail = obj
If Len(Mail.EntryID) = 0 Then
Set m_Inspector = Inspector
End If
End If
End Sub

Private Sub m_Inspector_Activate()
EnableTimer 100, Me
End Sub

Public Sub Timer()
On Error Resume Next
Dim Btn As Office.CommandBarButton
Dim Bars As Office.CommandBars

DisableTimer

Set Bars = m_Inspector.CommandBars
Set m_Inspector = Nothing
Set Btn = Bars.FindControl(, 1079)
Btn.Execute
End Sub


Additionally, you need a timer function. Click Insert/Module, then visit:
http://www.vboffice.net/sample.html?mnu=2&pub=6&smp=4&cmd=showitem&lang=en

and copy *only* the code beginning after the comment line

' <Modul: modTimer.bas>

into your new module.

That's it. Save the project, and close the VBA editor. Ensure via
Tools/Macro/Security that VBA will be executed. Then close Outlook and
restart it.

--
Best regards
Michael Bauer - MVP Outlook
Use Outlook Categories? This is Your Tool:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Am Fri, 8 Feb 2008 15:27:01 -0800 schrieb Guneet:
 
Top