Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Message Rule Does Not Run VBA Procedure (http://www.outlookbanter.com/outlook-vba/7555-message-rule-does-not-run.html)

Lowell March 8th 06 05:00 PM

Message Rule Does Not Run VBA Procedure
 
Forgot to include this. After opening Outlook and on first attempt to access
the VB Editor, I get popup asking if I want to Disable/enable macros. This
dialog includes the project name under whihc I created the macros. Clicking
Enable results in File Not Found error being displayed. Close that dialog and
then get to the VB Editor with the problems mentioned in previous post.

"Lowell" wrote:

More trouble. This morning, I tested my rule/macro again. Nothing worked. Got
an error message saying the script did not exist. Went into VB Editor and the
whole project, module, and code are gone. Most options on the menus are
unavailable, except for a few things on the Format, View and Tools menu. I
cannot create a new project or module. My security level is still set on
medium and I have checked the Help/About/Disabled items - nothing is disabled.

Any ideas on what has happened. It appears I've totally lost VB capability
within Outlook. Still have it in Excel/Word.

"Lowell" wrote:

I found the problem, at least on my PC, and just came back to post it and saw
your post, Sue. You were right on. Somehow, my Security setting had gotten
changed to High, so all macros were disabled. I got an error message (macros
disabled) when I tried to run a simple MsgBox procedure. Thanks.

"Sue Mosher [MVP-Outlook]" wrote:

Does other VBA code, such as a simple MsgBox "Hello" procedure run? Did you check the setting in Tools | Macro | Security? Does it work if you rewrite it to use the intrinsic Application object and get the message from its EntryID, as in:

Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
' do stuff with olMail, e.g.
MsgBox olMail.SUbject

Set olMail = Nothing
Set olNS = Nothing
End Sub

--
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


"Lowell" wrote in message ...
Created a message rule to check for a message with an attachment from a
specific sender. I set the rule to run a procedure I had created based on
info I saw here and elsewhere. Everything worked fine initially. It even
worked on a friend's PC, for whom I created the procedure.

A day or two later, friend notifies me that nothing works. Checked my system
and found the same. We have both recreated the message rule and reset it to
the procedure. No go.

The procedure is below. The first two lines after the Dim statements were
commented out initially and everything worked. Since the failure, we both
have uncommented the two lines, one at a time, to see if they were the source
of the problem. I set a a toggle break point, sent myself a message meeting
the rule's requirements, and the procedure was never accessed by the rule.
What am I missing?

Public Sub SaveAttachment(MyMail As MailItem)
Dim MyAttachment As Object
Dim MyOlApp As Object



'Set MyOlApp = CreateObject("Outlook.Application")
'Set MyMail = MyOlApp.ActiveInspector.CurrentItem
Set MyAttachment = MyMail.Attachments
MyAttachment.Item(1).SaveAsFile "C:\Documents and Settings\LB\My
Documents\temp\" & _
MyAttachment.Item(1).DisplayName

Exit Sub
End Sub


Sue Mosher [MVP-Outlook] March 8th 06 05:10 PM

Message Rule Does Not Run VBA Procedure
 
My experience is that the VBAProject.OTM file can be a little fragile, especially if you're using "run a script" rules. The way to back up your modules is to export them.

You could try changing the security setting to Low to see if that helps the file recovery, but I fear it may be totally corrupted, in which case the cure would be to shut down Outlook, rename VBAProject.OTM, then restart Outlook and let Outlook create a new, clean, empty one.
--
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


"Lowell" wrote in message ...
More trouble. This morning, I tested my rule/macro again. Nothing worked. Got
an error message saying the script did not exist. Went into VB Editor and the
whole project, module, and code are gone. Most options on the menus are
unavailable, except for a few things on the Format, View and Tools menu. I
cannot create a new project or module. My security level is still set on
medium and I have checked the Help/About/Disabled items - nothing is disabled.

Any ideas on what has happened. It appears I've totally lost VB capability
within Outlook. Still have it in Excel/Word.

"Lowell" wrote:

I found the problem, at least on my PC, and just came back to post it and saw
your post, Sue. You were right on. Somehow, my Security setting had gotten
changed to High, so all macros were disabled. I got an error message (macros
disabled) when I tried to run a simple MsgBox procedure. Thanks.

"Sue Mosher [MVP-Outlook]" wrote:

Does other VBA code, such as a simple MsgBox "Hello" procedure run? Did you check the setting in Tools | Macro | Security? Does it work if you rewrite it to use the intrinsic Application object and get the message from its EntryID, as in:

Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
' do stuff with olMail, e.g.
MsgBox olMail.SUbject

Set olMail = Nothing
Set olNS = Nothing
End Sub

--
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


"Lowell" wrote in message ...
Created a message rule to check for a message with an attachment from a
specific sender. I set the rule to run a procedure I had created based on
info I saw here and elsewhere. Everything worked fine initially. It even
worked on a friend's PC, for whom I created the procedure.

A day or two later, friend notifies me that nothing works. Checked my system
and found the same. We have both recreated the message rule and reset it to
the procedure. No go.

The procedure is below. The first two lines after the Dim statements were
commented out initially and everything worked. Since the failure, we both
have uncommented the two lines, one at a time, to see if they were the source
of the problem. I set a a toggle break point, sent myself a message meeting
the rule's requirements, and the procedure was never accessed by the rule.
What am I missing?

Public Sub SaveAttachment(MyMail As MailItem)
Dim MyAttachment As Object
Dim MyOlApp As Object



'Set MyOlApp = CreateObject("Outlook.Application")
'Set MyMail = MyOlApp.ActiveInspector.CurrentItem
Set MyAttachment = MyMail.Attachments
MyAttachment.Item(1).SaveAsFile "C:\Documents and Settings\LB\My
Documents\temp\" & _
MyAttachment.Item(1).DisplayName

Exit Sub
End Sub


Lowell March 8th 06 09:51 PM

Message Rule Does Not Run VBA Procedure
 
Sue - That worked. However, instead of having VBAProject.OTM in the Project
Explorer pane of VB Editor, I now have an item named Project 1. Should I
rename it to VBAProject.OTM?

"Sue Mosher [MVP-Outlook]" wrote:

My experience is that the VBAProject.OTM file can be a little fragile, especially if you're using "run a script" rules. The way to back up your modules is to export them.

You could try changing the security setting to Low to see if that helps the file recovery, but I fear it may be totally corrupted, in which case the cure would be to shut down Outlook, rename VBAProject.OTM, then restart Outlook and let Outlook create a new, clean, empty one.
--
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


"Lowell" wrote in message ...
More trouble. This morning, I tested my rule/macro again. Nothing worked. Got
an error message saying the script did not exist. Went into VB Editor and the
whole project, module, and code are gone. Most options on the menus are
unavailable, except for a few things on the Format, View and Tools menu. I
cannot create a new project or module. My security level is still set on
medium and I have checked the Help/About/Disabled items - nothing is disabled.

Any ideas on what has happened. It appears I've totally lost VB capability
within Outlook. Still have it in Excel/Word.

"Lowell" wrote:

I found the problem, at least on my PC, and just came back to post it and saw
your post, Sue. You were right on. Somehow, my Security setting had gotten
changed to High, so all macros were disabled. I got an error message (macros
disabled) when I tried to run a simple MsgBox procedure. Thanks.

"Sue Mosher [MVP-Outlook]" wrote:

Does other VBA code, such as a simple MsgBox "Hello" procedure run? Did you check the setting in Tools | Macro | Security? Does it work if you rewrite it to use the intrinsic Application object and get the message from its EntryID, as in:

Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
' do stuff with olMail, e.g.
MsgBox olMail.SUbject

Set olMail = Nothing
Set olNS = Nothing
End Sub

--
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


"Lowell" wrote in message ...
Created a message rule to check for a message with an attachment from a
specific sender. I set the rule to run a procedure I had created based on
info I saw here and elsewhere. Everything worked fine initially. It even
worked on a friend's PC, for whom I created the procedure.

A day or two later, friend notifies me that nothing works. Checked my system
and found the same. We have both recreated the message rule and reset it to
the procedure. No go.

The procedure is below. The first two lines after the Dim statements were
commented out initially and everything worked. Since the failure, we both
have uncommented the two lines, one at a time, to see if they were the source
of the problem. I set a a toggle break point, sent myself a message meeting
the rule's requirements, and the procedure was never accessed by the rule.
What am I missing?

Public Sub SaveAttachment(MyMail As MailItem)
Dim MyAttachment As Object
Dim MyOlApp As Object



'Set MyOlApp = CreateObject("Outlook.Application")
'Set MyMail = MyOlApp.ActiveInspector.CurrentItem
Set MyAttachment = MyMail.Attachments
MyAttachment.Item(1).SaveAsFile "C:\Documents and Settings\LB\My
Documents\temp\" & _
MyAttachment.Item(1).DisplayName

Exit Sub
End Sub



Sue Mosher [MVP-Outlook] March 8th 06 10:51 PM

Message Rule Does Not Run VBA Procedure
 
The file *is* named Vbaproject.otm. The project name doesn't matter.

--
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


"Lowell" wrote in message ...
Sue - That worked. However, instead of having VBAProject.OTM in the Project
Explorer pane of VB Editor, I now have an item named Project 1. Should I
rename it to VBAProject.OTM?

"Sue Mosher [MVP-Outlook]" wrote:

My experience is that the VBAProject.OTM file can be a little fragile, especially if you're using "run a script" rules. The way to back up your modules is to export them.

You could try changing the security setting to Low to see if that helps the file recovery, but I fear it may be totally corrupted, in which case the cure would be to shut down Outlook, rename VBAProject.OTM, then restart Outlook and let Outlook create a new, clean, empty one.



"Lowell" wrote in message ...
More trouble. This morning, I tested my rule/macro again. Nothing worked. Got
an error message saying the script did not exist. Went into VB Editor and the
whole project, module, and code are gone. Most options on the menus are
unavailable, except for a few things on the Format, View and Tools menu. I
cannot create a new project or module. My security level is still set on
medium and I have checked the Help/About/Disabled items - nothing is disabled.

Any ideas on what has happened. It appears I've totally lost VB capability
within Outlook. Still have it in Excel/Word.

"Lowell" wrote:

I found the problem, at least on my PC, and just came back to post it and saw
your post, Sue. You were right on. Somehow, my Security setting had gotten
changed to High, so all macros were disabled. I got an error message (macros
disabled) when I tried to run a simple MsgBox procedure. Thanks.

"Sue Mosher [MVP-Outlook]" wrote:

Does other VBA code, such as a simple MsgBox "Hello" procedure run? Did you check the setting in Tools | Macro | Security? Does it work if you rewrite it to use the intrinsic Application object and get the message from its EntryID, as in:

Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
' do stuff with olMail, e.g.
MsgBox olMail.SUbject

Set olMail = Nothing
Set olNS = Nothing
End Sub

--
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


"Lowell" wrote in message ...
Created a message rule to check for a message with an attachment from a
specific sender. I set the rule to run a procedure I had created based on
info I saw here and elsewhere. Everything worked fine initially. It even
worked on a friend's PC, for whom I created the procedure.

A day or two later, friend notifies me that nothing works. Checked my system
and found the same. We have both recreated the message rule and reset it to
the procedure. No go.

The procedure is below. The first two lines after the Dim statements were
commented out initially and everything worked. Since the failure, we both
have uncommented the two lines, one at a time, to see if they were the source
of the problem. I set a a toggle break point, sent myself a message meeting
the rule's requirements, and the procedure was never accessed by the rule.
What am I missing?

Public Sub SaveAttachment(MyMail As MailItem)
Dim MyAttachment As Object
Dim MyOlApp As Object



'Set MyOlApp = CreateObject("Outlook.Application")
'Set MyMail = MyOlApp.ActiveInspector.CurrentItem
Set MyAttachment = MyMail.Attachments
MyAttachment.Item(1).SaveAsFile "C:\Documents and Settings\LB\My
Documents\temp\" & _
MyAttachment.Item(1).DisplayName

Exit Sub
End Sub



Lowell March 8th 06 11:13 PM

Message Rule Does Not Run VBA Procedure
 
You want to know what's weird? After I renamed the original Vbaproject.otm
and got everything working again, there is not a new Vbaproject.otm in the
same folder as the one I renamed. I haven't found it (the new one) yet. Is
there a set location where this file is stored?

"Sue Mosher [MVP-Outlook]" wrote:

The file *is* named . The project name doesn't matter.

--
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


"Lowell" wrote in message ...
Sue - That worked. However, instead of having VBAProject.OTM in the Project
Explorer pane of VB Editor, I now have an item named Project 1. Should I
rename it to VBAProject.OTM?

"Sue Mosher [MVP-Outlook]" wrote:

My experience is that the VBAProject.OTM file can be a little fragile, especially if you're using "run a script" rules. The way to back up your modules is to export them.

You could try changing the security setting to Low to see if that helps the file recovery, but I fear it may be totally corrupted, in which case the cure would be to shut down Outlook, rename VBAProject.OTM, then restart Outlook and let Outlook create a new, clean, empty one.



"Lowell" wrote in message ...
More trouble. This morning, I tested my rule/macro again. Nothing worked. Got
an error message saying the script did not exist. Went into VB Editor and the
whole project, module, and code are gone. Most options on the menus are
unavailable, except for a few things on the Format, View and Tools menu. I
cannot create a new project or module. My security level is still set on
medium and I have checked the Help/About/Disabled items - nothing is disabled.

Any ideas on what has happened. It appears I've totally lost VB capability
within Outlook. Still have it in Excel/Word.

"Lowell" wrote:

I found the problem, at least on my PC, and just came back to post it and saw
your post, Sue. You were right on. Somehow, my Security setting had gotten
changed to High, so all macros were disabled. I got an error message (macros
disabled) when I tried to run a simple MsgBox procedure. Thanks.

"Sue Mosher [MVP-Outlook]" wrote:

Does other VBA code, such as a simple MsgBox "Hello" procedure run? Did you check the setting in Tools | Macro | Security? Does it work if you rewrite it to use the intrinsic Application object and get the message from its EntryID, as in:

Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
' do stuff with olMail, e.g.
MsgBox olMail.SUbject

Set olMail = Nothing
Set olNS = Nothing
End Sub

--
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


"Lowell" wrote in message ...
Created a message rule to check for a message with an attachment from a
specific sender. I set the rule to run a procedure I had created based on
info I saw here and elsewhere. Everything worked fine initially. It even
worked on a friend's PC, for whom I created the procedure.

A day or two later, friend notifies me that nothing works. Checked my system
and found the same. We have both recreated the message rule and reset it to
the procedure. No go.

The procedure is below. The first two lines after the Dim statements were
commented out initially and everything worked. Since the failure, we both
have uncommented the two lines, one at a time, to see if they were the source
of the problem. I set a a toggle break point, sent myself a message meeting
the rule's requirements, and the procedure was never accessed by the rule.
What am I missing?

Public Sub SaveAttachment(MyMail As MailItem)
Dim MyAttachment As Object
Dim MyOlApp As Object



'Set MyOlApp = CreateObject("Outlook.Application")
'Set MyMail = MyOlApp.ActiveInspector.CurrentItem
Set MyAttachment = MyMail.Attachments
MyAttachment.Item(1).SaveAsFile "C:\Documents and Settings\LB\My
Documents\temp\" & _
MyAttachment.Item(1).DisplayName

Exit Sub
End Sub




Sue Mosher [MVP-Outlook] March 9th 06 01:02 AM

Message Rule Does Not Run VBA Procedure
 
It's always in the same location, in your Windows profile folders. You won't see it if you don't have hidden/system items turned on.

--
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


"Lowell" wrote in message ...
You want to know what's weird? After I renamed the original Vbaproject.otm
and got everything working again, there is not a new Vbaproject.otm in the
same folder as the one I renamed. I haven't found it (the new one) yet. Is
there a set location where this file is stored?

"Sue Mosher [MVP-Outlook]" wrote:

The file *is* named vbaproject.otm. The project name doesn't matter.



"Lowell" wrote in message ...
Sue - That worked. However, instead of having VBAProject.OTM in the Project
Explorer pane of VB Editor, I now have an item named Project 1. Should I
rename it to VBAProject.OTM?

"Sue Mosher [MVP-Outlook]" wrote:

My experience is that the VBAProject.OTM file can be a little fragile, especially if you're using "run a script" rules. The way to back up your modules is to export them.

You could try changing the security setting to Low to see if that helps the file recovery, but I fear it may be totally corrupted, in which case the cure would be to shut down Outlook, rename VBAProject.OTM, then restart Outlook and let Outlook create a new, clean, empty one.



"Lowell" wrote in message ...
More trouble. This morning, I tested my rule/macro again. Nothing worked. Got
an error message saying the script did not exist. Went into VB Editor and the
whole project, module, and code are gone. Most options on the menus are
unavailable, except for a few things on the Format, View and Tools menu. I
cannot create a new project or module. My security level is still set on
medium and I have checked the Help/About/Disabled items - nothing is disabled.

Any ideas on what has happened. It appears I've totally lost VB capability
within Outlook. Still have it in Excel/Word.

"Lowell" wrote:

I found the problem, at least on my PC, and just came back to post it and saw
your post, Sue. You were right on. Somehow, my Security setting had gotten
changed to High, so all macros were disabled. I got an error message (macros
disabled) when I tried to run a simple MsgBox procedure. Thanks.

"Sue Mosher [MVP-Outlook]" wrote:

Does other VBA code, such as a simple MsgBox "Hello" procedure run? Did you check the setting in Tools | Macro | Security? Does it work if you rewrite it to use the intrinsic Application object and get the message from its EntryID, as in:

Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
' do stuff with olMail, e.g.
MsgBox olMail.SUbject

Set olMail = Nothing
Set olNS = Nothing
End Sub

--
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


"Lowell" wrote in message ...
Created a message rule to check for a message with an attachment from a
specific sender. I set the rule to run a procedure I had created based on
info I saw here and elsewhere. Everything worked fine initially. It even
worked on a friend's PC, for whom I created the procedure.

A day or two later, friend notifies me that nothing works. Checked my system
and found the same. We have both recreated the message rule and reset it to
the procedure. No go.

The procedure is below. The first two lines after the Dim statements were
commented out initially and everything worked. Since the failure, we both
have uncommented the two lines, one at a time, to see if they were the source
of the problem. I set a a toggle break point, sent myself a message meeting
the rule's requirements, and the procedure was never accessed by the rule.
What am I missing?

Public Sub SaveAttachment(MyMail As MailItem)
Dim MyAttachment As Object
Dim MyOlApp As Object



'Set MyOlApp = CreateObject("Outlook.Application")
'Set MyMail = MyOlApp.ActiveInspector.CurrentItem
Set MyAttachment = MyMail.Attachments
MyAttachment.Item(1).SaveAsFile "C:\Documents and Settings\LB\My
Documents\temp\" & _
MyAttachment.Item(1).DisplayName

Exit Sub
End Sub




Lowell March 9th 06 01:30 AM

Message Rule Does Not Run VBA Procedure
 
I searched and did not find it. My folder options are set to show hidden
files. I let the system search in the C:\Document and Settings folder, which
is where the user profiles are stored. I'm going to search the whole hard
disk. this is getting a little creepy, since I found the corrupted file and
can't find the newly generated one.

lowell
"Sue Mosher [MVP-Outlook]" wrote:

It's always in the same location, in your Windows profile folders. You won't see it if you don't have hidden/system items turned on.

--
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


"Lowell" wrote in message ...
You want to know what's weird? After I renamed the original Vbaproject.otm
and got everything working again, there is not a new Vbaproject.otm in the
same folder as the one I renamed. I haven't found it (the new one) yet. Is
there a set location where this file is stored?

"Sue Mosher [MVP-Outlook]" wrote:

The file *is* named vbaproject.otm. The project name doesn't matter.



"Lowell" wrote in message ...
Sue - That worked. However, instead of having VBAProject.OTM in the Project
Explorer pane of VB Editor, I now have an item named Project 1. Should I
rename it to VBAProject.OTM?

"Sue Mosher [MVP-Outlook]" wrote:

My experience is that the VBAProject.OTM file can be a little fragile, especially if you're using "run a script" rules. The way to back up your modules is to export them.

You could try changing the security setting to Low to see if that helps the file recovery, but I fear it may be totally corrupted, in which case the cure would be to shut down Outlook, rename VBAProject.OTM, then restart Outlook and let Outlook create a new, clean, empty one.


"Lowell" wrote in message ...
More trouble. This morning, I tested my rule/macro again. Nothing worked. Got
an error message saying the script did not exist. Went into VB Editor and the
whole project, module, and code are gone. Most options on the menus are
unavailable, except for a few things on the Format, View and Tools menu. I
cannot create a new project or module. My security level is still set on
medium and I have checked the Help/About/Disabled items - nothing is disabled.

Any ideas on what has happened. It appears I've totally lost VB capability
within Outlook. Still have it in Excel/Word.

"Lowell" wrote:

I found the problem, at least on my PC, and just came back to post it and saw
your post, Sue. You were right on. Somehow, my Security setting had gotten
changed to High, so all macros were disabled. I got an error message (macros
disabled) when I tried to run a simple MsgBox procedure. Thanks.

"Sue Mosher [MVP-Outlook]" wrote:

Does other VBA code, such as a simple MsgBox "Hello" procedure run? Did you check the setting in Tools | Macro | Security? Does it work if you rewrite it to use the intrinsic Application object and get the message from its EntryID, as in:

Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
' do stuff with olMail, e.g.
MsgBox olMail.SUbject

Set olMail = Nothing
Set olNS = Nothing
End Sub

--
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


"Lowell" wrote in message ...
Created a message rule to check for a message with an attachment from a
specific sender. I set the rule to run a procedure I had created based on
info I saw here and elsewhere. Everything worked fine initially. It even
worked on a friend's PC, for whom I created the procedure.

A day or two later, friend notifies me that nothing works. Checked my system
and found the same. We have both recreated the message rule and reset it to
the procedure. No go.

The procedure is below. The first two lines after the Dim statements were
commented out initially and everything worked. Since the failure, we both
have uncommented the two lines, one at a time, to see if they were the source
of the problem. I set a a toggle break point, sent myself a message meeting
the rule's requirements, and the procedure was never accessed by the rule.
What am I missing?

Public Sub SaveAttachment(MyMail As MailItem)
Dim MyAttachment As Object
Dim MyOlApp As Object



'Set MyOlApp = CreateObject("Outlook.Application")
'Set MyMail = MyOlApp.ActiveInspector.CurrentItem
Set MyAttachment = MyMail.Attachments
MyAttachment.Item(1).SaveAsFile "C:\Documents and Settings\LB\My
Documents\temp\" & _
MyAttachment.Item(1).DisplayName

Exit Sub
End Sub





Lowell March 9th 06 02:05 AM

Message Rule Does Not Run VBA Procedure
 
AHA! The file didn't get saved to the disk until I exited Outlook.

Lowell

"Lowell" wrote:

I searched and did not find it. My folder options are set to show hidden
files. I let the system search in the C:\Document and Settings folder, which
is where the user profiles are stored. I'm going to search the whole hard
disk. this is getting a little creepy, since I found the corrupted file and
can't find the newly generated one.

lowell
"Sue Mosher [MVP-Outlook]" wrote:

It's always in the same location, in your Windows profile folders. You won't see it if you don't have hidden/system items turned on.

--
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


"Lowell" wrote in message ...
You want to know what's weird? After I renamed the original Vbaproject.otm
and got everything working again, there is not a new Vbaproject.otm in the
same folder as the one I renamed. I haven't found it (the new one) yet. Is
there a set location where this file is stored?

"Sue Mosher [MVP-Outlook]" wrote:

The file *is* named vbaproject.otm. The project name doesn't matter.



"Lowell" wrote in message ...
Sue - That worked. However, instead of having VBAProject.OTM in the Project
Explorer pane of VB Editor, I now have an item named Project 1. Should I
rename it to VBAProject.OTM?

"Sue Mosher [MVP-Outlook]" wrote:

My experience is that the VBAProject.OTM file can be a little fragile, especially if you're using "run a script" rules. The way to back up your modules is to export them.

You could try changing the security setting to Low to see if that helps the file recovery, but I fear it may be totally corrupted, in which case the cure would be to shut down Outlook, rename VBAProject.OTM, then restart Outlook and let Outlook create a new, clean, empty one.


"Lowell" wrote in message ...
More trouble. This morning, I tested my rule/macro again. Nothing worked. Got
an error message saying the script did not exist. Went into VB Editor and the
whole project, module, and code are gone. Most options on the menus are
unavailable, except for a few things on the Format, View and Tools menu. I
cannot create a new project or module. My security level is still set on
medium and I have checked the Help/About/Disabled items - nothing is disabled.

Any ideas on what has happened. It appears I've totally lost VB capability
within Outlook. Still have it in Excel/Word.

"Lowell" wrote:

I found the problem, at least on my PC, and just came back to post it and saw
your post, Sue. You were right on. Somehow, my Security setting had gotten
changed to High, so all macros were disabled. I got an error message (macros
disabled) when I tried to run a simple MsgBox procedure. Thanks.

"Sue Mosher [MVP-Outlook]" wrote:

Does other VBA code, such as a simple MsgBox "Hello" procedure run? Did you check the setting in Tools | Macro | Security? Does it work if you rewrite it to use the intrinsic Application object and get the message from its EntryID, as in:

Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
' do stuff with olMail, e.g.
MsgBox olMail.SUbject

Set olMail = Nothing
Set olNS = Nothing
End Sub

--
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


"Lowell" wrote in message ...
Created a message rule to check for a message with an attachment from a
specific sender. I set the rule to run a procedure I had created based on
info I saw here and elsewhere. Everything worked fine initially. It even
worked on a friend's PC, for whom I created the procedure.

A day or two later, friend notifies me that nothing works. Checked my system
and found the same. We have both recreated the message rule and reset it to
the procedure. No go.

The procedure is below. The first two lines after the Dim statements were
commented out initially and everything worked. Since the failure, we both
have uncommented the two lines, one at a time, to see if they were the source
of the problem. I set a a toggle break point, sent myself a message meeting
the rule's requirements, and the procedure was never accessed by the rule.
What am I missing?

Public Sub SaveAttachment(MyMail As MailItem)
Dim MyAttachment As Object
Dim MyOlApp As Object



'Set MyOlApp = CreateObject("Outlook.Application")
'Set MyMail = MyOlApp.ActiveInspector.CurrentItem
Set MyAttachment = MyMail.Attachments
MyAttachment.Item(1).SaveAsFile "C:\Documents and Settings\LB\My
Documents\temp\" & _
MyAttachment.Item(1).DisplayName

Exit Sub
End Sub





Lowell March 9th 06 07:47 PM

Message Rule Does Not Run VBA Procedure
 
Sue - just wanted to say thanks one more time for your help. With this new
installation of the rule/macro, things seem much more stable. I'm not geting
that VB editor window with no menus/toolbars mysteriuosly popping up this
time. Maybe we've gotten this one handled.

Again, thank you.
Lowell

"Sue Mosher [MVP-Outlook]" wrote:

It's always in the same location, in your Windows profile folders. You won't see it if you don't have hidden/system items turned on.

--
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


"Lowell" wrote in message ...
You want to know what's weird? After I renamed the original Vbaproject.otm
and got everything working again, there is not a new Vbaproject.otm in the
same folder as the one I renamed. I haven't found it (the new one) yet. Is
there a set location where this file is stored?

"Sue Mosher [MVP-Outlook]" wrote:

The file *is* named vbaproject.otm. The project name doesn't matter.



"Lowell" wrote in message ...
Sue - That worked. However, instead of having VBAProject.OTM in the Project
Explorer pane of VB Editor, I now have an item named Project 1. Should I
rename it to VBAProject.OTM?

"Sue Mosher [MVP-Outlook]" wrote:

My experience is that the VBAProject.OTM file can be a little fragile, especially if you're using "run a script" rules. The way to back up your modules is to export them.

You could try changing the security setting to Low to see if that helps the file recovery, but I fear it may be totally corrupted, in which case the cure would be to shut down Outlook, rename VBAProject.OTM, then restart Outlook and let Outlook create a new, clean, empty one.


"Lowell" wrote in message ...
More trouble. This morning, I tested my rule/macro again. Nothing worked. Got
an error message saying the script did not exist. Went into VB Editor and the
whole project, module, and code are gone. Most options on the menus are
unavailable, except for a few things on the Format, View and Tools menu. I
cannot create a new project or module. My security level is still set on
medium and I have checked the Help/About/Disabled items - nothing is disabled.

Any ideas on what has happened. It appears I've totally lost VB capability
within Outlook. Still have it in Excel/Word.

"Lowell" wrote:

I found the problem, at least on my PC, and just came back to post it and saw
your post, Sue. You were right on. Somehow, my Security setting had gotten
changed to High, so all macros were disabled. I got an error message (macros
disabled) when I tried to run a simple MsgBox procedure. Thanks.

"Sue Mosher [MVP-Outlook]" wrote:

Does other VBA code, such as a simple MsgBox "Hello" procedure run? Did you check the setting in Tools | Macro | Security? Does it work if you rewrite it to use the intrinsic Application object and get the message from its EntryID, as in:

Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
' do stuff with olMail, e.g.
MsgBox olMail.SUbject

Set olMail = Nothing
Set olNS = Nothing
End Sub

--
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


"Lowell" wrote in message ...
Created a message rule to check for a message with an attachment from a
specific sender. I set the rule to run a procedure I had created based on
info I saw here and elsewhere. Everything worked fine initially. It even
worked on a friend's PC, for whom I created the procedure.

A day or two later, friend notifies me that nothing works. Checked my system
and found the same. We have both recreated the message rule and reset it to
the procedure. No go.

The procedure is below. The first two lines after the Dim statements were
commented out initially and everything worked. Since the failure, we both
have uncommented the two lines, one at a time, to see if they were the source
of the problem. I set a a toggle break point, sent myself a message meeting
the rule's requirements, and the procedure was never accessed by the rule.
What am I missing?

Public Sub SaveAttachment(MyMail As MailItem)
Dim MyAttachment As Object
Dim MyOlApp As Object



'Set MyOlApp = CreateObject("Outlook.Application")
'Set MyMail = MyOlApp.ActiveInspector.CurrentItem
Set MyAttachment = MyMail.Attachments
MyAttachment.Item(1).SaveAsFile "C:\Documents and Settings\LB\My
Documents\temp\" & _
MyAttachment.Item(1).DisplayName

Exit Sub
End Sub






All times are GMT +1. The time now is 09:22 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com