Open User Form from Template and populate message

T

Tahlmorrah

Scenario: Need to open a user form on open of Outlook Template (.oft) and
have it auto open a UserForm to populate then have a subject and message body
creaded from information entered in the UserForm.

Problem: Have a standard template where the To: and CC: field are
semi-permanent (i.e will only change if someone leave the company, but needs
to be changed at template level rather than in VB). The data in the message
body is volitile but is consistantly the same type of information in the same
format...see below. Need to have a easy way to input this information into
the e-mail and then allow changes before send.

Main problem is I do not know and can not understand the object names in
Outlook

Sample completed e-mail:
Please dispatch Tech to center <TxtBxCenter> to complete <TxtBxIssue>
Technician must call <TxtBxTech> at <TxtBxPhone> after equipment is
installed, for further instructions.
Please dispatch at Severity <TxtBxSev>. <TxtBxReason>.
Equipment will arrive <TxtBxDate> by 10:30 <TxtBxTZ>
Center is open from <TxtBxHO> to <TxtBxHC> <TxtBxTZ>

Sample Code so far:
In Microsoft Outlook Object.This Outlook Session
Private Sub ThisOutlookSession_Open()
TSGRequest.Show 0 <-- Does not work
End Sub

In Forms.TSGRequest
Private Sub CmdBtnSubmit_Click()

End Sub

Private Sub TSGRequest_Activate()
TxtBxHO = "0800"
TxtBxHC = "1700"
TxtBxTZ = "EDT"
TxtBxTech = "????"
TxtBxPhone = "###.###.####"
TxtBxSev = "5"
TxtBxReason = "Center is having difficulty meeting volume"
TxtBxDate = Date + 1
TxtBxIssue = "Hard drive swap and minor configuration"
End Sub

Private Sub CmdBtnClear_Click()
TxtBxHO = ""
TxtBxHC = ""
TxtBxTZ = ""
TxtBxTech = ""
TxtBxPhone = ""
TxtBxSev = ""
TxtBxReason = ""
TxtBxDate = ""
TxtBxIssue = ""
End Sub

Main Difficulty:
UserForm does not autoopen when template is loaded
Filename TSGDispatch.oft

Private Sub CmdBtnSubmit_Click()
Need to put something here to establish subject line such as "Dispatch
center <TxtBxCenter>"
Enter Message Boday <see sample completed e-mail above>
Close TSGRequest.form
End Sub

Tons of thanks in advance. I know this can be done as I have it working in
Excel and Word, jusr cannot figure out the commands for Outlook.

Jason
 
M

Michael Bauer

Hi Jason,

you can use the NewInspector event and check its subject. For that you
need to know the item´s subject, of course.

<GlobalData.bas>
Public Const TEMPLATE_SUBJECT as String ="Dispatch center <TxtBxCenter>"
Public Const REPLACE_SUBJECT as String ="<TxtBxCenter>"
</GlobalData.bas>

<ThisOutlookSession>
Option Explicit
Private WithEvents Inspectors As Outlook.Inspectors

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

Private Sub Inspectors_NewInspector(ByVal Inspector As
Outlook.Inspector)
If Inspector.CurrentItem.Subject = TEMPLATE_SUBJECT Then
' It´s your template. Open now your UserForm. Because I think the
user should be forced to fill in the data in TSGRequest I´d open the
form modal instead of non-modal
TSGRequest.Show 1
End If
End Sub
</ThisOutlookSession>

<TSGDispatch>
Private Sub CmdBtnSubmit_Click()
Dim oMail as Outlook.MailItem
Set oMail=Application.ActiveInspector.CurrentItem

' Sample for the Subject, assuming "txtBxCenter" is a Textcontrol
oMail.Subject = Replace(oMail.Subject, REPLACE_SUBJECT,
txtBxCenter.Text)

' This you can repeat for every placeholder in the MailItem´s Body.
Unload TSGRequest
End Sub
</TSGDispatch>
 
T

Tahlmorrah

Macros under Tools, Macros, Visual Basic is not displaying GlobalData.bas so
I am unsure of how to access this. Furthermore the form is still not popping
up. I agree with your suggestions so now the code looks like

<ThisOutlookSession>
Option Explicit
Private WithEvents Inspectors As Outlook.Inspectors


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

Private Sub Inspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
If Inspector.CurrentItem.Subject = TEMPLATE_SUBJECT Then
TSGRequest.Show 1
End If
End Sub
</ThisOutlookSession>

<TSGRequest>

Private Sub CmdBtnSubmit_Click()
Dim oMail As Outlook.MailItem
Dim ReplaceHO As String
Dim ReplaceHC As String
Dim ReplaceTZ As String
Dim ReplaceTech As String
Dim ReplacePhone As String
Dim ReplaceSev As String
Dim ReplaceReason As String
Dim ReplaceDate As String
Dim ReplaceIssue As String
Set oMail = Application.ActiveInspector.CurrentItem

TxtSubject = "Dispatch TSG Center " & TxtBxCenter
ReplaceHO = "<TxtBxHO>"
ReplaceHC = "<TxtBxHC>"
ReplaceTZ = "<TxtBxTZ>"
ReplaceTech = "<TxtBxTech>"
ReplacePhone = "<TxtBxPhone>"
ReplaceSev = "<TxtBxSev>"
ReplaceReason = "<TxtBxReason>"
ReplaceDate = "<TxtBxDate>"
ReplaceIssue = "<TxtBxIssue>"

oMail.Subject = TxtSubject.Text
oMail.Body = Replace(oMail.Body, ReplaceHO, TxtBxHO.Text)
oMail.Body = Replace(oMail.Body, ReplaceHC, TxtBxHC.Text)
oMail.Body = Replace(oMail.Body, ReplaceTZ, TxtBxTZ.Text)
oMail.Body = Replace(oMail.Body, ReplaceTech, TxtBxTech.Text)
oMail.Body = Replace(oMail.Body, ReplacePhone, TxtBxPhone.Text)
oMail.Body = Replace(oMail.Body, ReplaceSev, TxtBxSev.Text)
oMail.Body = Replace(oMail.Body, ReplaceReason, TxtBxReason.Text)
oMail.Body = Replace(oMail.Body, ReplaceDate, TxtBxDate.Text)
oMail.Body = Replace(oMail.Body, ReplaceIssue, TxtBxIssue.Text)

Unload TSGRequest
End Sub

Private Sub TSGRequest_Activate()
TxtBxHO = "0800"
TxtBxHC = "1700"
TxtBxTZ = "EDT"
TxtBxTech = "Tech Ops"
TxtBxPhone = "800.546.8008"
TxtBxSev = "5"
TxtBxReason = "Center is having difficulty meeting volume"
TxtBxDate = Date + 1
TxtBxIssue = "Hard drive swap and minor configuration"
End Sub
Private Sub CmdBtnClear_Click()
TxtBxHO = ""
TxtBxHC = ""
TxtBxTZ = ""
TxtBxTech = ""
TxtBxPhone = ""
TxtBxSev = ""
TxtBxReason = ""
TxtBxDate = ""
TxtBxIssue = ""
End Sub
</TSGRequest>

Understand where you are going with this, but can not figure out why it will
not popup the form.

Jason Dvorchak
 
M

Michael Bauer

Hi Jason,

the reason for the global constant TEMPLATE_SUBJECT is that both
modules, ThisOutlookSession and your UserForm, can use the same subject
without having to define it twice. For a global constant you´d need a
standard module, which you can add to the project (Insert/Module) and
name it like you want to.

After making changes to the code you´d need to restart OL or set the
cursor into Application_Startup and run it manually (press F5).
 
T

Tahlmorrah

Unfortunatly the user form is still not autoloading on open of the template.
What am I doing wrong?

<ThisOutlookSession>
Option Explicit
Private WithEvents Inspectors As Outlook.Inspectors

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

Private Sub Inspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
If Inspector.CurrentItem.Subject = TEMPLATE_SUBJECT Then
TSGRequest.Show 1
End If
End Sub
</ThisOutlookSession>

<TSGRequest>
Private Sub CmdBtnSubmit_Click()
Dim oMail As Outlook.MailItem
Dim ReplaceHO As String
Dim ReplaceHC As String
Dim ReplaceTZ As String
Dim ReplaceTech As String
Dim ReplacePhone As String
Dim ReplaceSev As String
Dim ReplaceReason As String
Dim ReplaceDate As String
Dim ReplaceIssue As String
Set oMail = Application.ActiveInspector.CurrentItem

ReplaceHO = "<TxtBxHO>"
ReplaceHC = "<TxtBxHC>"
ReplaceTZ = "<TxtBxTZ>"
ReplaceTech = "<TxtBxTech>"
ReplacePhone = "<TxtBxPhone>"
ReplaceSev = "<TxtBxSev>"
ReplaceReason = "<TxtBxReason>"
ReplaceDate = "<TxtBxDate>"
ReplaceIssue = "<TxtBxIssue>"

oMail.Subject = Replace(oMail.Subject, REPLACE_SUBJECT, TxtBxCenter.Text)
oMail.Body = Replace(oMail.Body, ReplaceHO, TxtBxHO.Text)
oMail.Body = Replace(oMail.Body, ReplaceHC, TxtBxHC.Text)
oMail.Body = Replace(oMail.Body, ReplaceTZ, TxtBxTZ.Text)
oMail.Body = Replace(oMail.Body, ReplaceTech, TxtBxTech.Text)
oMail.Body = Replace(oMail.Body, ReplacePhone, TxtBxPhone.Text)
oMail.Body = Replace(oMail.Body, ReplaceSev, TxtBxSev.Text)
oMail.Body = Replace(oMail.Body, ReplaceReason, TxtBxReason.Text)
oMail.Body = Replace(oMail.Body, ReplaceDate, TxtBxDate.Text)
oMail.Body = Replace(oMail.Body, ReplaceIssue, TxtBxIssue.Text)

Unload TSGRequest
End Sub

Private Sub TSGRequest_Activate()
TxtBxHO = "0800"
TxtBxHC = "1700"
TxtBxTZ = "EDT"
TxtBxTech = "Tech Ops"
TxtBxPhone = "800.546.8008"
TxtBxSev = "5"
TxtBxReason = "Center is having difficulty meeting volume"
TxtBxDate = Date + 1
TxtBxIssue = "Hard drive swap and minor configuration"
End Sub
Private Sub CmdBtnClear_Click()
TxtBxHO = ""
TxtBxHC = ""
TxtBxTZ = ""
TxtBxTech = ""
TxtBxPhone = ""
TxtBxSev = ""
TxtBxReason = ""
TxtBxDate = ""
TxtBxIssue = ""
End Sub

</TSGRequest>

<Module1>
Public Const TEMPLATE_SUBJECT As String = "Dispatch center < TxtBxCenter >"
Public Const REPLACE_SUBJECT As String = "<TxtBxCenter>"

</Module1>

Jason
 
M

Michael Bauer

Hi Jason,
If Inspector.CurrentItem.Subject = TEMPLATE_SUBJECT Then

please set a breakpoint (F9) in that line. Does the execution stops
there if you´re opening a new Inspector? If so then obviously the item´s
subject isn´t equal to the one defined in the constant.
 
T

Tahlmorrah

Started to get promted for macros after Outlook after closed and reopen
Outlook. If open template at that point, prompts for macros and opens
userform when changed

<ThisOutlookSession>
Private Sub Application_Startup()
Set Inspectors = Application.Inspectors
TSGRequest.Show 1
End Sub
</ThisOutlookSession>

However this is not accomplishing what I need to. Users need to keep Outlook
open at all times. When this template is selected they need the userform to
open automatically on top of the template.

Progress is slow, but its progress
Thanks again
Jason
 
M

Michael Bauer

Started to get promted for macros after Outlook after closed and
reopen
Outlook. If open template at that point, prompts for macros and opens
userform when changed

Not sure, what you´re saying.

As I mentioned earlier, you need to restart OL after making changes to
the code or run Application_Startup manually. The execution of this
function is important. If it´s done once and you don´t make more changes
to the code then OL can stay opened till the end of the days.
Private Sub Application_Startup()
Set Inspectors = Application.Inspectors
TSGRequest.Show 1

This is not what I´ve suggested.
 
T

Tahlmorrah

Not sure, what you´re saying.

I do not care that my security settings ask me to enable macros. This is
working as intended. I only want it to prompt when this .oft is opened as it
is more secure. It appears that I need to add something that is local to the
..oft rather than ThisOutlookSession. I only used ThisOutlookSession as I do
not know how to accomplish this so it is only contained in the .oft.

All security settings are Custom based off of the Medium setting.

The intention is to make a self contained macro in the template that only
activates when the template opens. Having macros that activate when Outlook
opens is not an option due to it compromising system security.

Here is the desired sequence of events:
1. User opens Outlook and works on it throughout the day
2. User has need of template and opens template by clicking on the .oft file
3. Prompted to enable macros in the .oft
4. Userform is displayed
5. Completes userform and Submits
6. Text on Template is changed with the entered information
7. User can make additional changes as necessary
8. E-mail is sent
9. User continues to use Outlook as normal
10. User has need of template and opens template
11. See step 3.
This is not what I´ve suggested.
I understand that is not what you have suggested, but this is the only way I
have been able to get the userform to even show. If you can tell me how to
get the userform to show when the template opens, I will be more than glad to
change the code. This is my primary problem at this time.

Jason
 
S

Sue Mosher [MVP-Outlook]

PMJI, but unpublished Outlook forms (e.g. .oft files) don't prompt for macros in Outlook 2000 SP2 or later, unless the Exchange administrator has specifically set up security settings in the Outlook Security Settings folder to allow such prompts to occur. There is no user-defined option to make .oft files prompt to run code.
 
M

Michael Bauer

Hi Jason,

sorry, I understand less and less. The sample I´ve given to you must be
executed in VBA, modul "ThisOutlookSession". You can´t move this code
into your *.oft template.

Whether you´re using VBScript in your template or not, because you´re
also using an UserForm you have to enable VBA anyway.

Or do you mean your *.oft template when talking about an UserForm? If so
then it seems that you´d need help for VBScript, not VBA. That´s not my
area.

(IMHO VBA is more secure than using scripting in an template. It´s not
easy to change or manipulate the project file (*.otm) - but very easy to
change your *.oft file.)
 
T

Tahlmorrah

Thank you for letting me know that I had to have those items in
ThisOutlookSession. I do not consider that secure at all, but we can only
work within the limitations Microsoft has given us.

The Template named TSG Dispatch.oft has the following VBA code attached to it:
<Microsoft Outlook Objects>
<This Outlook Session>

Option Explicit
Private WithEvents Inspectors As Outlook.Inspectors

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

Private Sub Inspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
If Inspector.CurrentItem.Subject = TEMPLATE_SUBJECT Then
TSGRequest.Show 1
End If
End Sub
</This Outlook Session>
</Microsoft Outlook Objects>

<Forms>
<TSGRequest>

Private Sub CmdBtnSubmit_Click()
Set oMail = Application.ActiveInspector.CurrentItem

ReplaceCenter = "<TxtBxCenter>"
ReplaceHO = "<TxtBxHO>"
ReplaceHC = "<TxtBxHC>"
ReplaceTZ = "<TxtBxTZ>"
ReplaceTech = "<TxtBxTech>"
ReplacePhone = "<TxtBxPhone>"
ReplaceSev = "<TxtBxSev>"
ReplaceReason = "<TxtBxReason>"
ReplaceDate = "<TxtBxDate>"
ReplaceIssue = "<TxtBxIssue>"

oMail.Subject = Replace(oMail.Subject, ReplaceCenter, TxtBxCenter.Text)
oMail.Body = Replace(oMail.Body, ReplaceCenter, TxtBxCenter.Text)
oMail.Body = Replace(oMail.Body, ReplaceHO, TxtBxHO.Text)
oMail.Body = Replace(oMail.Body, ReplaceHC, TxtBxHC.Text)
oMail.Body = Replace(oMail.Body, ReplaceTZ, TxtBxTZ.Text)
oMail.Body = Replace(oMail.Body, ReplaceTech, TxtBxTech.Text)
oMail.Body = Replace(oMail.Body, ReplacePhone, TxtBxPhone.Text)
oMail.Body = Replace(oMail.Body, ReplaceSev, TxtBxSev.Text)
oMail.Body = Replace(oMail.Body, ReplaceReason, TxtBxReason.Text)
oMail.Body = Replace(oMail.Body, ReplaceDate, TxtBxDate.Text)
oMail.Body = Replace(oMail.Body, ReplaceIssue, TxtBxIssue.Text)

Unload TSGRequest
End Sub

Private Sub CmdBtnClear_Click()
TxtBxCenter = ""
TxtBxHO = ""
TxtBxHC = ""
TxtBxTZ = ""
TxtBxTech = ""
TxtBxPhone = ""
TxtBxSev = ""
TxtBxReason = ""
TxtBxDate = ""
TxtBxIssue = ""
End Sub

Private Sub TSGRequest_Activate()
TxtBxDate.Text = DateAdd("d", 1, Date)

End Sub

</TSGRequest>
</Forms>

<Modules>
<Module1>

Public Const TEMPLATE_SUBJECT As String = "TSG Dispatch Center <TxtBxCenter>"
Public Const REPLACE_SUBJECT As String = "<TxtBxCenter>"

</Module1>
</Modules>

Problem: Userform:TSGRequest does not automatically open when template TSG
Dispatch.oft is opened. Pretty sure I need a load or activate command
referancing userform:TSGRequest somewhere in the code so that when the .oft
is opened it pops up, but I am unsure of the command or where it should be
placed.

Believe or not this has been helpful. I get bits and pieces here and there
that help improve my knowledge of VBA and how it relates to Outlook, and as
you can see parts that help improve my code.

Jason
 
M

Michael Bauer

Wow, I begin to feel like someone in the German TV Show "Hidden
camera"... Anyway, I try it again .-)

The Template named TSG Dispatch.oft has the following VBA code attached to it:
<Microsoft Outlook Objects>
<This Outlook Session>

The code behind an *.oft template isn´t VBA, but VBS. And what I gave to
you is VBA. That means, it isn´t working in VBS, i.e. also isn´t
working behind an *.oft template.

Please open the VBA environment (ALT+F11) and display the Project
Explorer (STRG+R). The modul "ThisOutlookSession" belongs already to the
project. This is the modul where the code needs to be which I have
included in the <ThisOutlookSession> tags. To this project you can add
the additional standard modul with the Const declarations.

To clarify that: It could be perfectly possible that there is also a way
for just using VBS behind the template without any VBA - but I don´t
know that. If you want to try that VBS way then, please, throw my sample
away and forget it - believe me, it won´t work and that´s not a point of
any security settings.

BTW: What "limitations" you´re talking about?

--
Viele Grüße / Best regards
Michael Bauer - MVP Outlook


Tahlmorrah said:
Thank you for letting me know that I had to have those items in
ThisOutlookSession. I do not consider that secure at all, but we can only
work within the limitations Microsoft has given us.

The Template named TSG Dispatch.oft has the following VBA code attached to it:
<Microsoft Outlook Objects>
<This Outlook Session>

Option Explicit
Private WithEvents Inspectors As Outlook.Inspectors

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

Private Sub Inspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
If Inspector.CurrentItem.Subject = TEMPLATE_SUBJECT Then
TSGRequest.Show 1
End If
End Sub
</This Outlook Session>
</Microsoft Outlook Objects>

<Forms>
<TSGRequest>

Private Sub CmdBtnSubmit_Click()
Set oMail = Application.ActiveInspector.CurrentItem

ReplaceCenter = "<TxtBxCenter>"
ReplaceHO = "<TxtBxHO>"
ReplaceHC = "<TxtBxHC>"
ReplaceTZ = "<TxtBxTZ>"
ReplaceTech = "<TxtBxTech>"
ReplacePhone = "<TxtBxPhone>"
ReplaceSev = "<TxtBxSev>"
ReplaceReason = "<TxtBxReason>"
ReplaceDate = "<TxtBxDate>"
ReplaceIssue = "<TxtBxIssue>"

oMail.Subject = Replace(oMail.Subject, ReplaceCenter, TxtBxCenter.Text)
oMail.Body = Replace(oMail.Body, ReplaceCenter, TxtBxCenter.Text)
oMail.Body = Replace(oMail.Body, ReplaceHO, TxtBxHO.Text)
oMail.Body = Replace(oMail.Body, ReplaceHC, TxtBxHC.Text)
oMail.Body = Replace(oMail.Body, ReplaceTZ, TxtBxTZ.Text)
oMail.Body = Replace(oMail.Body, ReplaceTech, TxtBxTech.Text)
oMail.Body = Replace(oMail.Body, ReplacePhone, TxtBxPhone.Text)
oMail.Body = Replace(oMail.Body, ReplaceSev, TxtBxSev.Text)
oMail.Body = Replace(oMail.Body, ReplaceReason, TxtBxReason.Text)
oMail.Body = Replace(oMail.Body, ReplaceDate, TxtBxDate.Text)
oMail.Body = Replace(oMail.Body, ReplaceIssue, TxtBxIssue.Text)

Unload TSGRequest
End Sub

Private Sub CmdBtnClear_Click()
TxtBxCenter = ""
TxtBxHO = ""
TxtBxHC = ""
TxtBxTZ = ""
TxtBxTech = ""
TxtBxPhone = ""
TxtBxSev = ""
TxtBxReason = ""
TxtBxDate = ""
TxtBxIssue = ""
End Sub

Private Sub TSGRequest_Activate()
TxtBxDate.Text = DateAdd("d", 1, Date)

End Sub

</TSGRequest>
</Forms>

<Modules>
<Module1>

Public Const TEMPLATE_SUBJECT As String = "TSG Dispatch Center
Public Const REPLACE_SUBJECT As String = "<TxtBxCenter>"

</Module1>
</Modules>

Problem: Userform:TSGRequest does not automatically open when template TSG
Dispatch.oft is opened. Pretty sure I need a load or activate command
referancing userform:TSGRequest somewhere in the code so that when the .oft
is opened it pops up, but I am unsure of the command or where it should be
placed.

Believe or not this has been helpful. I get bits and pieces here and there
that help improve my knowledge of VBA and how it relates to Outlook, and as
you can see parts that help improve my code.

Jason
looks
 
T

Tahlmorrah

My turn to be confused. Did exactly as requested. From Outlook pressed
Alt+F11 it opened Project1(VbaProject.OTM) with the exact code listed below.

I do not have the tools to work in VBS, so I am working in VBA.

The "limitations" that I am speaking about is that in other Microsoft Office
products I can tie code to the document I am working on (i.e. I can have
different code for one Word template to the next, same for Excel, and of
course for Access) that only affects that document, but Outlook does not seem
to function the same way. Therefore I believe, maybe incorrectly, that
Outlook is more limited than the previously listed Microsoft products.

Jason
 
M

Michael Bauer

Hi Jason,

first, I know one exception when my sample doesn´t work: The code won´t
be executed if OL is not running already and you´re opening the template
from within the file Explorer.


The OL Object Modell is in fact something different to e.g. Word`s.
That´s no limitation, but regards the different data structure.

For attaching code to a file you´d need to customize the Mail Form in
your case. Then you can open a script editor and insert some VBS code.
This customized form you can save as an *.oft template.

I´ve searched for you in the VBA help. Please see the sample for the
Open event. It works in VBS, too.

*AFAIK* you can´t run an UserForm from within a CustomForm directly. If
I´m right, then you could add a public method to ThisOutlookSession,
which
you can call from the customized form. From within this method the
UserForm can be called.

Some more explanations to my sample:

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

This method must run once. It´s called from OL automatically while
startup. I.e., after writing this code (or after modifying any other
code in your project) you need to re-start OL.

It´s also the reason for the exception mentioned on top: Without having
the Inspectors variable set already, you won´t get any of its event.

Private Sub Inspectors_NewInspector(ByVal Inspector As
Outlook.Inspector)
If Inspector.CurrentItem.Subject = TEMPLATE_SUBJECT Then
TSGRequest.Show 1
End If
End Sub

After execution of the code in Application_Startup this event procedure
will be executed every times when an Inspector is going to be opened.
For recognizing whether it´s your template or not the CurrentItem´s
Subject will be checked. The '=' operator is case-sensitive, i.e.
TSGRequest.Show 1 is called only when the Subject is absolutely equal to
the value stored in TEMPLATE_SUBJECT.

Due to TSGRequest shall be shown modal the code execution in this event
will be stopped. I.e. the Inspector will be displayed not before
TSGRequest is unloaded.

So I´m sure if:

- macros are enabled at all (security settings)
- and you have followed my suggested steps (re-start OL after coding)

then the events will be executed. If in addition:

- the template´s subject is *equal* to TEMPLATE_SUBJECT (="TSG Dispatch
Center
<TxtBxCenter>" in your case) then the UserForm will be shown.

HTH
 
S

Sue Mosher [MVP-Outlook]

Note that code will not run on items created from a form saved as an ..oft template.
 
M

Michael Bauer

Thanks, Sue.


--
Viele Grüße / Best regards
Michael Bauer - MVP Outlook


Note that code will not run on items created from a form saved as an
..oft template.
 

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