A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Macro works in Word 2007, but not in Outlook 2007



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 2nd 07, 06:50 AM posted to microsoft.public.outlook.program_vba
LesG
external usenet poster
 
Posts: 9
Default Macro works in Word 2007, but not in Outlook 2007

For years I used a macro in Outlook Xp which I recorded in Word XP. I think
it had something to do with th fact that in that program Word was my email
editor.
The same macro now works in Word 2007 as it should, but when I try to run it
in Outlook 2007 I get a "Runtime error 424. Object required" error warning.
I have never written a macro, I merely recorded the last one, so please be
gently with me in your reply :-)

Regards; Les
Ads
  #2  
Old March 2nd 07, 10:20 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Macro works in Word 2007, but not in Outlook 2007



Please show the code and the line that raises the error.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am Thu, 1 Mar 2007 22:50:00 -0800 schrieb LesG:

For years I used a macro in Outlook Xp which I recorded in Word XP. I

think
it had something to do with th fact that in that program Word was my email
editor.
The same macro now works in Word 2007 as it should, but when I try to run

it
in Outlook 2007 I get a "Runtime error 424. Object required" error

warning.
I have never written a macro, I merely recorded the last one, so please be
gently with me in your reply :-)

Regards; Les

  #3  
Old March 2nd 07, 10:48 AM posted to microsoft.public.outlook.program_vba
LesG
external usenet poster
 
Posts: 9
Default Macro works in Word 2007, but not in Outlook 2007

Hi Michael,
thank you for your reply. It highlights the line:
"Selection.Find.ClearFormatting" and then "With Selection.Find"
As I mentioned, it works perfectly fine in Word.
I hope this is what you mean by showing the code:

Sub Magyar()
'
' Magyar Macro
' Macro recorded 29/09/00 by LGaram
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "aa"
.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
With Selection.Find
.Text = "ee"
.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
With Selection.Find
.Text = "ii"
.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
With Selection.Find
.Text = "oo"
.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
With Selection.Find
.Text = "uu"
.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
With Selection.Find
.Text = "o:"
.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
With Selection.Find
.Text = "u:"
.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
With Selection.Find
.Text = "o"""
.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
With Selection.Find
.Text = "u"""
.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


"Michael Bauer [MVP - Outlook]" wrote:



Please show the code and the line that raises the error.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am Thu, 1 Mar 2007 22:50:00 -0800 schrieb LesG:

For years I used a macro in Outlook Xp which I recorded in Word XP. I

think
it had something to do with th fact that in that program Word was my email
editor.
The same macro now works in Word 2007 as it should, but when I try to run

it
in Outlook 2007 I get a "Runtime error 424. Object required" error

warning.
I have never written a macro, I merely recorded the last one, so please be
gently with me in your reply :-)

Regards; Les


  #4  
Old March 2nd 07, 12:07 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Macro works in Word 2007, but not in Outlook 2007



Yes, that's what I meant. For sure, that code never ran in Outlook :-)

You might try the following: Add a reference to Word's object library, in
Outlook via Tools/References. Then replace "Selection" by wdSelection and
insert a few lines at the beginning:

Dim wdSelection As Word.Selection
Dim wdDoc as Word.Document

Set wdDoc=Application.ActiveInspector.CurrentItem.Word Editor
Set wdSelection=wdDoc.ActiveWindow.Selection

That should give you the selection of the currently opened e-mail.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am Fri, 2 Mar 2007 02:48:25 -0800 schrieb LesG:

Hi Michael,
thank you for your reply. It highlights the line:
"Selection.Find.ClearFormatting" and then "With Selection.Find"
As I mentioned, it works perfectly fine in Word.
I hope this is what you mean by showing the code:

Sub Magyar()
'
' Magyar Macro
' Macro recorded 29/09/00 by LGaram
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "aa"
.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
With Selection.Find
.Text = "ee"
.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
With Selection.Find
.Text = "ii"
.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
With Selection.Find
.Text = "oo"
.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
With Selection.Find
.Text = "uu"
.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
With Selection.Find
.Text = "o:"
.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
With Selection.Find
.Text = "u:"
.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
With Selection.Find
.Text = "o"""
.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
With Selection.Find
.Text = "u"""
.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


"Michael Bauer [MVP - Outlook]" wrote:



Please show the code and the line that raises the error.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am Thu, 1 Mar 2007 22:50:00 -0800 schrieb LesG:

For years I used a macro in Outlook Xp which I recorded in Word XP. I

think
it had something to do with th fact that in that program Word was my

email
editor.
The same macro now works in Word 2007 as it should, but when I try to

run
it
in Outlook 2007 I get a "Runtime error 424. Object required" error

warning.
I have never written a macro, I merely recorded the last one, so please

be
gently with me in your reply :-)

Regards; Les


  #5  
Old March 3rd 07, 12:10 PM posted to microsoft.public.outlook.program_vba
LesG
external usenet poster
 
Posts: 9
Default Macro works in Word 2007, but not in Outlook 2007

Hi Michael

thanx for the tips. I found the Word's object library reference OK. But i
have trouble with the rest; this is what I did and now i get a "Run time
error 438. Object doesn't support this property or method". Anyway, this is
the first part of the macro:
(and thank you for your patience with me :-)

Sub Magyar()
'
' Magyar Macro
' Macro recorded 29/09/00 by LGaram
'
Dim wdSelection As Word.Selection
Dim wdDoc As Word.Document

Set wdDoc = Application.ActiveInspector.CurrentItem.WordEditor
Set wdSelection = wdDoc.ActiveWindow.Selection

wdSelection.Find.ClearFormatting
wdSelection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "aa"
.Replacement.Text = "á"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With



"Michael Bauer [MVP - Outlook]" wrote:



Yes, that's what I meant. For sure, that code never ran in Outlook :-)

You might try the following: Add a reference to Word's object library, in
Outlook via Tools/References. Then replace "Selection" by wdSelection and
insert a few lines at the beginning:

Dim wdSelection As Word.Selection
Dim wdDoc as Word.Document

Set wdDoc=Application.ActiveInspector.CurrentItem.Word Editor
Set wdSelection=wdDoc.ActiveWindow.Selection

That should give you the selection of the currently opened e-mail.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am Fri, 2 Mar 2007 02:48:25 -0800 schrieb LesG:

Hi Michael,
thank you for your reply. It highlights the line:
"Selection.Find.ClearFormatting" and then "With Selection.Find"
As I mentioned, it works perfectly fine in Word.
I hope this is what you mean by showing the code:

Sub Magyar()
'
' Magyar Macro
' Macro recorded 29/09/00 by LGaram
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "aa"
.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
With Selection.Find
.Text = "ee"
.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
With Selection.Find
.Text = "ii"
.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
With Selection.Find
.Text = "oo"
.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
With Selection.Find
.Text = "uu"
.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
With Selection.Find
.Text = "o:"
.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
With Selection.Find
.Text = "u:"
.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
With Selection.Find
.Text = "o"""
.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
With Selection.Find
.Text = "u"""
.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


"Michael Bauer [MVP - Outlook]" wrote:



Please show the code and the line that raises the error.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am Thu, 1 Mar 2007 22:50:00 -0800 schrieb LesG:

For years I used a macro in Outlook Xp which I recorded in Word XP. I
think
it had something to do with th fact that in that program Word was my

email
editor.
The same macro now works in Word 2007 as it should, but when I try to

run
it
in Outlook 2007 I get a "Runtime error 424. Object required" error
warning.
I have never written a macro, I merely recorded the last one, so please

be
gently with me in your reply :-)

Regards; Les


  #6  
Old March 3rd 07, 03:41 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Macro works in Word 2007, but not in Outlook 2007


What line causes that error?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)


Am Sat, 3 Mar 2007 04:10:05 -0800 schrieb LesG:

Hi Michael

thanx for the tips. I found the Word's object library reference OK. But i
have trouble with the rest; this is what I did and now i get a "Run time
error 438. Object doesn't support this property or method". Anyway, this

is
the first part of the macro:
(and thank you for your patience with me :-)

Sub Magyar()
'
' Magyar Macro
' Macro recorded 29/09/00 by LGaram
'
Dim wdSelection As Word.Selection
Dim wdDoc As Word.Document

Set wdDoc = Application.ActiveInspector.CurrentItem.WordEditor
Set wdSelection = wdDoc.ActiveWindow.Selection

wdSelection.Find.ClearFormatting
wdSelection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "aa"
.Replacement.Text = "á"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With



"Michael Bauer [MVP - Outlook]" wrote:



Yes, that's what I meant. For sure, that code never ran in Outlook :-)

You might try the following: Add a reference to Word's object library, in
Outlook via Tools/References. Then replace "Selection" by wdSelection and
insert a few lines at the beginning:

Dim wdSelection As Word.Selection
Dim wdDoc as Word.Document

Set wdDoc=Application.ActiveInspector.CurrentItem.Word Editor
Set wdSelection=wdDoc.ActiveWindow.Selection

That should give you the selection of the currently opened e-mail.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am Fri, 2 Mar 2007 02:48:25 -0800 schrieb LesG:

Hi Michael,
thank you for your reply. It highlights the line:
"Selection.Find.ClearFormatting" and then "With Selection.Find"
As I mentioned, it works perfectly fine in Word.
I hope this is what you mean by showing the code:

Sub Magyar()
'
' Magyar Macro
' Macro recorded 29/09/00 by LGaram
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "aa"
.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
With Selection.Find
.Text = "ee"
.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
With Selection.Find
.Text = "ii"
.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
With Selection.Find
.Text = "oo"
.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
With Selection.Find
.Text = "uu"
.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
With Selection.Find
.Text = "o:"
.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
With Selection.Find
.Text = "u:"
.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
With Selection.Find
.Text = "o"""
.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
With Selection.Find
.Text = "u"""
.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


"Michael Bauer [MVP - Outlook]" wrote:



Please show the code and the line that raises the error.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am Thu, 1 Mar 2007 22:50:00 -0800 schrieb LesG:

For years I used a macro in Outlook Xp which I recorded in Word XP. I
think
it had something to do with th fact that in that program Word was my

email
editor.
The same macro now works in Word 2007 as it should, but when I try to

run
it
in Outlook 2007 I get a "Runtime error 424. Object required" error
warning.
I have never written a macro, I merely recorded the last one, so

please
be
gently with me in your reply :-)

Regards; Les


  #7  
Old March 3rd 07, 04:36 PM posted to microsoft.public.outlook.program_vba
Howard Kaikow
external usenet poster
 
Posts: 41
Default Macro works in Word 2007, but not in Outlook 2007

With wdSelection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "aa"
.Replacement.Text = "á"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
--
http://www.standards.com/; See Howard Kaikow's web site.


  #8  
Old March 4th 07, 12:18 AM posted to microsoft.public.outlook.program_vba
LesG
external usenet poster
 
Posts: 9
Default Macro works in Word 2007, but not in Outlook 2007

It doesn't highlight anything this time. It just gives the error.
This is becoming really difficult, because i have NO idea what am i doing.
I just simply do not understand the reason behind having a previous version
of Outlook running a macro from Word perfectly well, but a supposedly
"superior" package is not capable to do so, without major changes. That is a
major step - backwards.
And as I mentioned, the very same macro runs in Word perfectly.

"Michael Bauer [MVP - Outlook]" wrote:


What line causes that error?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)


Am Sat, 3 Mar 2007 04:10:05 -0800 schrieb LesG:

Hi Michael

thanx for the tips. I found the Word's object library reference OK. But i
have trouble with the rest; this is what I did and now i get a "Run time
error 438. Object doesn't support this property or method". Anyway, this

is
the first part of the macro:
(and thank you for your patience with me :-)

Sub Magyar()
'
' Magyar Macro
' Macro recorded 29/09/00 by LGaram
'
Dim wdSelection As Word.Selection
Dim wdDoc As Word.Document

Set wdDoc = Application.ActiveInspector.CurrentItem.WordEditor
Set wdSelection = wdDoc.ActiveWindow.Selection

wdSelection.Find.ClearFormatting
wdSelection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "aa"
.Replacement.Text = "á"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With



"Michael Bauer [MVP - Outlook]" wrote:



Yes, that's what I meant. For sure, that code never ran in Outlook :-)

You might try the following: Add a reference to Word's object library, in
Outlook via Tools/References. Then replace "Selection" by wdSelection and
insert a few lines at the beginning:

Dim wdSelection As Word.Selection
Dim wdDoc as Word.Document

Set wdDoc=Application.ActiveInspector.CurrentItem.Word Editor
Set wdSelection=wdDoc.ActiveWindow.Selection

That should give you the selection of the currently opened e-mail.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am Fri, 2 Mar 2007 02:48:25 -0800 schrieb LesG:

Hi Michael,
thank you for your reply. It highlights the line:
"Selection.Find.ClearFormatting" and then "With Selection.Find"
As I mentioned, it works perfectly fine in Word.
I hope this is what you mean by showing the code:

Sub Magyar()
'
' Magyar Macro
' Macro recorded 29/09/00 by LGaram
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "aa"
.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
With Selection.Find
.Text = "ee"
.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
With Selection.Find
.Text = "ii"
.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
With Selection.Find
.Text = "oo"
.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
With Selection.Find
.Text = "uu"
.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
With Selection.Find
.Text = "o:"
.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
With Selection.Find
.Text = "u:"
.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
With Selection.Find
.Text = "o"""
.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
With Selection.Find
.Text = "u"""
.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


"Michael Bauer [MVP - Outlook]" wrote:



Please show the code and the line that raises the error.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am Thu, 1 Mar 2007 22:50:00 -0800 schrieb LesG:

For years I used a macro in Outlook Xp which I recorded in Word XP. I
think
it had something to do with th fact that in that program Word was my
email
editor.
The same macro now works in Word 2007 as it should, but when I try to
run
it
in Outlook 2007 I get a "Runtime error 424. Object required" error
warning.
I have never written a macro, I merely recorded the last one, so

please
be
gently with me in your reply :-)

Regards; Les



  #9  
Old March 4th 07, 12:23 AM posted to microsoft.public.outlook.program_vba
LesG
external usenet poster
 
Posts: 9
Default Macro works in Word 2007, but not in Outlook 2007

Thanks Howard!
You were a great help providing the code as I have no experience with macro
code, I only used a "recorder" to create the one in question.
I copied the code you wrote, replacing the original, but I get a Run-time
error '438'
Regards; Les

"Howard Kaikow" wrote:

With wdSelection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "aa"
.Replacement.Text = "á"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
--
http://www.standards.com/; See Howard Kaikow's web site.



  #10  
Old March 4th 07, 09:21 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Macro works in Word 2007, but not in Outlook 2007


Les, as mentioned, the code never ran in Outlook. The code was recorded
within Word and only Word knows what to do with it.

One error I see now, which I made myself:
Set wdDoc = Application.ActiveInspector.CurrentItem.WordEditor


must be:
Set wdDoc = Application.ActiveInspector.WordEditor

If it still doesn't work, you can go through the code step by step: Select
the first line (Sub Magyar) and press f9 for a breakpoint. Start the
procedure, then it stops at that breakpoint. Now press f8 for the next step
and so on. Watch, what line causes an error.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)


Am Sat, 3 Mar 2007 16:18:00 -0800 schrieb LesG:

It doesn't highlight anything this time. It just gives the error.
This is becoming really difficult, because i have NO idea what am i doing.
I just simply do not understand the reason behind having a previous

version
of Outlook running a macro from Word perfectly well, but a supposedly
"superior" package is not capable to do so, without major changes. That is

a
major step - backwards.
And as I mentioned, the very same macro runs in Word perfectly.

"Michael Bauer [MVP - Outlook]" wrote:


What line causes that error?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)


Am Sat, 3 Mar 2007 04:10:05 -0800 schrieb LesG:

Hi Michael

thanx for the tips. I found the Word's object library reference OK. But

i
have trouble with the rest; this is what I did and now i get a "Run time
error 438. Object doesn't support this property or method". Anyway, this

is
the first part of the macro:
(and thank you for your patience with me :-)

Sub Magyar()
'
' Magyar Macro
' Macro recorded 29/09/00 by LGaram
'
Dim wdSelection As Word.Selection
Dim wdDoc As Word.Document

Set wdDoc = Application.ActiveInspector.CurrentItem.WordEditor
Set wdSelection = wdDoc.ActiveWindow.Selection

wdSelection.Find.ClearFormatting
wdSelection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "aa"
.Replacement.Text = "á"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With



"Michael Bauer [MVP - Outlook]" wrote:



Yes, that's what I meant. For sure, that code never ran in Outlook :-)

You might try the following: Add a reference to Word's object library,

in
Outlook via Tools/References. Then replace "Selection" by wdSelection

and
insert a few lines at the beginning:

Dim wdSelection As Word.Selection
Dim wdDoc as Word.Document

Set wdDoc=Application.ActiveInspector.CurrentItem.Word Editor
Set wdSelection=wdDoc.ActiveWindow.Selection

That should give you the selection of the currently opened e-mail.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am Fri, 2 Mar 2007 02:48:25 -0800 schrieb LesG:

Hi Michael,
thank you for your reply. It highlights the line:
"Selection.Find.ClearFormatting" and then "With Selection.Find"
As I mentioned, it works perfectly fine in Word.
I hope this is what you mean by showing the code:

Sub Magyar()
'
' Magyar Macro
' Macro recorded 29/09/00 by LGaram
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "aa"
.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
With Selection.Find
.Text = "ee"
.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
With Selection.Find
.Text = "ii"
.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
With Selection.Find
.Text = "oo"
.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
With Selection.Find
.Text = "uu"
.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
With Selection.Find
.Text = "o:"
.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
With Selection.Find
.Text = "u:"
.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
With Selection.Find
.Text = "o"""
.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
With Selection.Find
.Text = "u"""
.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


"Michael Bauer [MVP - Outlook]" wrote:



Please show the code and the line that raises the error.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!

http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am Thu, 1 Mar 2007 22:50:00 -0800 schrieb LesG:

For years I used a macro in Outlook Xp which I recorded in Word XP.

I
think
it had something to do with th fact that in that program Word was my
email
editor.
The same macro now works in Word 2007 as it should, but when I try

to
run
it
in Outlook 2007 I get a "Runtime error 424. Object required" error
warning.
I have never written a macro, I merely recorded the last one, so

please
be
gently with me in your reply :-)

Regards; Les



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Vista Windows Mail works fine...but Outlook 2007 won't receive ema Vanderrg Outlook - Installation 4 April 9th 08 09:23 PM
Can't get CommandBars in 2007, works in other Outlook versions? Beiley Add-ins for Outlook 0 February 14th 07 12:18 AM
outlook 2007 with word 2007 installed not working Stephen Outlook - Installation 2 January 22nd 07 04:47 PM
Outlook 2007 no more works after Technical Refresh Ernst Kessler Outlook - Installation 0 September 30th 06 10:22 AM
How can I insert an address from Outlook 2007 into Word 2007? Ron Perry Outlook - Using Contacts 2 June 6th 06 03:24 AM


All times are GMT +1. The time now is 03:50 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-2025 Outlook Banter.
The comments are property of their posters.