PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Will Outlook allow programmatic modification of vbaproject.otm?

Reply

Will Outlook allow programmatic modification of vbaproject.otm?

 
Thread Tools Rate Thread
Old 17-11-2005, 08:07 AM   #1
Howard Kaikow
Guest
 
Posts: n/a
Default Will Outlook allow programmatic modification of vbaproject.otm?


With Word, Excel, etc, I can programmatically add code to a project and add
a reference to any required libraries.
Should be able to use just about the same code for Outlook/

Will Outlook allow me to do this?

Seems easier to do this than to ask users to manually modify the project.

--
http://www.standards.com/; See Howard Kaikow's web site.


  Reply With Quote
Old 17-11-2005, 01:38 PM   #2
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: Will Outlook allow programmatic modification of vbaproject.otm?

No, Outlook doesn't support that.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Howard Kaikow" <kaikow@standards.com> wrote in message news:eHgCkW06FHA.3136@TK2MSFTNGP09.phx.gbl...
> With Word, Excel, etc, I can programmatically add code to a project and add
> a reference to any required libraries.
> Should be able to use just about the same code for Outlook/
>
> Will Outlook allow me to do this?
>
> Seems easier to do this than to ask users to manually modify the project.
>
> --
> http://www.standards.com/; See Howard Kaikow's web site.
>
>

  Reply With Quote
Old 17-11-2005, 04:36 PM   #3
Howard Kaikow
Guest
 
Posts: n/a
Default Re: Will Outlook allow programmatic modification of vbaproject.otm?

"Sue Mosher [MVP-Outlook]" <suemvp@outlookcode.com> wrote in message
news:OU$sCa36FHA.3232@TK2MSFTNGP15.phx.gbl...
No, Outlook doesn't support that.

Thanx.

So, the alternative is to use a COM add-in or supply instructuctions to
manually modify the OTM.


  Reply With Quote
Old 17-11-2005, 07:08 PM   #4
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: Will Outlook allow programmatic modification of vbaproject.otm?

Exactly. An add-in would, of course, be preferable.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Howard Kaikow" <kaikow@standards.com> wrote in message news:uIMB7y46FHA.1416@TK2MSFTNGP09.phx.gbl...
> "Sue Mosher [MVP-Outlook]" <suemvp@outlookcode.com> wrote in message
> news:OU$sCa36FHA.3232@TK2MSFTNGP15.phx.gbl...
> No, Outlook doesn't support that.
>
> Thanx.
>
> So, the alternative is to use a COM add-in or supply instructuctions to
> manually modify the OTM.
>
>

  Reply With Quote
Old 17-11-2005, 09:06 PM   #5
Howard Kaikow
Guest
 
Posts: n/a
Default Re: Will Outlook allow programmatic modification of vbaproject.otm?

"Sue Mosher [MVP-Outlook]" <suemvp@outlookcode.com> wrote in message
news:eid5MO66FHA.3544@TK2MSFTNGP09.phx.gbl...
Exactly. An add-in would, of course, be preferable.

COM add-in would be overkill, but since the weak Outlook object model does
not expose VB projects, I've got little choice.


  Reply With Quote
Old 18-11-2005, 01:56 PM   #6
Howard Kaikow
Guest
 
Posts: n/a
Default Re: Will Outlook allow programmatic modification of vbaproject.otm?

"Sue Mosher [MVP-Outlook]" <suemvp@outlookcode.com> wrote in message
news:eid5MO66FHA.3544@TK2MSFTNGP09.phx.gbl...
Exactly. An add-in would, of course, be preferable.

Using a COM add-in, can I provide code that can run from a rule, such as
the example you give on pages 67-68 of your MSFT Outlook Programming book?


  Reply With Quote
Old 18-11-2005, 02:28 PM   #7
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: Will Outlook allow programmatic modification of vbaproject.otm?

No, the "run a script" rule action works only with VBA code. Instead, you'd build your add-in to work with the NewMailEx, NewMail, or MAPIFolder.Items.Add event.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Howard Kaikow" <kaikow@standards.com> wrote in message news:urezM%23D7FHA.1000@tk2msftngp13.phx.gbl...
> "Sue Mosher [MVP-Outlook]" <suemvp@outlookcode.com> wrote in message
> news:eid5MO66FHA.3544@TK2MSFTNGP09.phx.gbl...
> Exactly. An add-in would, of course, be preferable.
>
> Using a COM add-in, can I provide code that can run from a rule, such as
> the example you give on pages 67-68 of your MSFT Outlook Programming book?
>
>

  Reply With Quote
Old 18-11-2005, 06:46 PM   #8
Howard Kaikow
Guest
 
Posts: n/a
Default Re: Will Outlook allow programmatic modification of vbaproject.otm?

"Sue Mosher [MVP-Outlook]" <suemvp@outlookcode.com> wrote in message
news:O9M4fnE7FHA.3660@TK2MSFTNGP09.phx.gbl...
No, the "run a script" rule action works only with VBA code. Instead, you'd
build your add-in to work with the NewMailEx, NewMail, or
MAPIFolder.Items.Add event.

I'm after the equivalent of "run a script" so I would not want the code to
run automatically.
The code should be able to run anywhere within the set of rules defined by
the user, otherwise the order of filtering may not be that desired by the
user.

What about including a stub in the VBA that invokes a procedure in the COM
DLL?
The "run a script" could then refer to the stub.


  Reply With Quote
Old 18-11-2005, 07:20 PM   #9
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: Will Outlook allow programmatic modification of vbaproject.otm?

That might be a great solution. You'd still have the manual VBA installation issue, but with a lot less code to replace if vbaproject.otm corrupts (as it has been known to do).

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Howard Kaikow" <kaikow@standards.com> wrote in message news:ORl40fG7FHA.2716@TK2MSFTNGP11.phx.gbl...
>
> I'm after the equivalent of "run a script" so I would not want the code to
> run automatically.
> The code should be able to run anywhere within the set of rules defined by
> the user, otherwise the order of filtering may not be that desired by the
> user.
>
> What about including a stub in the VBA that invokes a procedure in the COM
> DLL?
> The "run a script" could then refer to the stub.
>
>

  Reply With Quote
Old 18-11-2005, 10:44 PM   #10
Howard Kaikow
Guest
 
Posts: n/a
Default Re: Will Outlook allow programmatic modification of vbaproject.otm?

"Sue Mosher [MVP-Outlook]" <suemvp@outlookcode.com> wrote in message
news:udJ69yG7FHA.268@TK2MSFTNGP10.phx.gbl...

>That might be a great solution. You'd still have the manual VBA

installation issue, but with a lot less code to replace >if vbaproject.otm
corrupts (as it has been known to do).

That's my standard solution using a normal VB 6 ActiveX DLL.

With Word, Excel, etc., I use a setup program that actually creates the code
and adds the reference in the template/workbook. Alas, since the Outloook
object model does not expose the VBProject, there's a silly, unnecessary
roadblock to proper setup programs with Outlook.



With an ActiveX DLL, I can use a setup program to register the critter, but
the user will have to manually insert a reference in the VBAProject.otm..



With a COM add-in, I guess the effective difference is that the user won't
have to include a reference to the DLL, but will still have to manually
insert the stubs.



ThisOutlookSession would require code like


Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
EFItemSend Item
End Sub



Private Sub Application_Quit()
TerminateMyMailFilters 2
End Sub



Private Sub Application_Startup()
SetupMyMailFilters 1
End Sub



And there would need to be a standard module in vbaproject.otm like the code
below.



I can make the module an importable .bas file, but the ThisOutlookSession
stuff would have to be entered manually, as well as the reference to the
DLL.



Why in the world was the Outlook object model so crippled? Makes no sense?



Public EF As clsMyMailFilters



Public Sub MyIncomingFilters(objMsg As Outlook.MailItem)
' SetupClass
EF.ProcessIncomingFilters objMsg
End Sub



Public Sub SetupMyMailFilters(lngDummy As Long)
' SetupClass
Set EF = New clsMyMailFilters
EF.ReadMyMailFilterFile
End Sub



Public Sub TerminateMyMailFilters(lngDummy As Long)
Set EF = Nothing
End Sub



Public Sub EFItemSend(ByVal Item As Object)
If TypeName(Item) = "MailItem" Then
With Item

' Code to be determined
'Debug.Print "Outgoing:" & vbCrLf _
& "SenderEmailAddress:" & .SenderEmailAddress & vbCrLf _
& "SenderName:" & .SenderName & vbCrLf _
& "Subject:" & .Subject & vbCrLf _
& "To:" & .To & vbCrLf _
& "Cc:" & .CC & vbCrLf _
& "Importance:" & .Importance & vbCrLf _
& "Bcc:" & .BCC & vbCrLf _
& "Body: " & vbCrLf _
& .Body
End With
End If
End Sub









  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off