D
DontEvenBother
I am having problems with my Outlook freezing when I run macros
containing WORD VBA in them. I posted this to the Outlook forum, but
the MVP there suggested I try here as it is the Word VBA code that
seems to be causing this.
Since outlook is set up to use word as my email editor I want to be
able to take advantage of macros stored in my Normal.dot template to
perform some simple text searches & replacements.
After running a macro in an email message window (new messages or
replies) , the send button along with every other button/tool on that
row of Outlook toolbars (i.e. the Accounts drop-box, the attachment
icon, address book button, options, etc.) becomes disabled. I kind of
need the SEND button! I click, but nothing happens. The buttons are
all dead. They no longer change color when hovered over, or animate,
etc. I've tested it on 3 machines at work as well as my computer at
home and can replicate it 100% of the time.
I have isolated the problem to one Selection.Find statement, but
haven't done any exhaustive testing to be sure something else can't
trigger it as well. Here's the example:
Sub RemovePhone()
'
' RemovePhone Macro
' Macro recorded 2/14/2006 by JG
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^#^#^#-^#^#^#-^#^#^#^#"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
The last statement in the sub -- the Select.Find -- is the only one
that, if commented out or removed, stops the freezing behavior.
Any help would be greatly appreciated as this is driving me crazy and
slowing me down having to manually replace text in each message.
Thanks!
Jim
(Using Office XP Pro SP3 with windows XP Pro.)
containing WORD VBA in them. I posted this to the Outlook forum, but
the MVP there suggested I try here as it is the Word VBA code that
seems to be causing this.
Since outlook is set up to use word as my email editor I want to be
able to take advantage of macros stored in my Normal.dot template to
perform some simple text searches & replacements.
After running a macro in an email message window (new messages or
replies) , the send button along with every other button/tool on that
row of Outlook toolbars (i.e. the Accounts drop-box, the attachment
icon, address book button, options, etc.) becomes disabled. I kind of
need the SEND button! I click, but nothing happens. The buttons are
all dead. They no longer change color when hovered over, or animate,
etc. I've tested it on 3 machines at work as well as my computer at
home and can replicate it 100% of the time.
I have isolated the problem to one Selection.Find statement, but
haven't done any exhaustive testing to be sure something else can't
trigger it as well. Here's the example:
Sub RemovePhone()
'
' RemovePhone Macro
' Macro recorded 2/14/2006 by JG
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^#^#^#-^#^#^#-^#^#^#^#"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
The last statement in the sub -- the Select.Find -- is the only one
that, if commented out or removed, stops the freezing behavior.
Any help would be greatly appreciated as this is driving me crazy and
slowing me down having to manually replace text in each message.
Thanks!
Jim
(Using Office XP Pro SP3 with windows XP Pro.)