macros for characters

G

Guest

Before Outlook 2007 all my Word macros for characters worked fine also in
Outlook, as I used Word as Outlook editor.

Withthat no longer possible, I have successfully transferred my macros into
normalemail.dotm, however they do not execute as intended.

All have the typical structure:
Sub Euro()
' Euro Macro
Selection.TypeText Text:="€"
End Sub

While they execute fine in Word, in Outlook I get an error:

Run-Time Error ‘424’:
Object Required

Any help/suggestions would be appreciated.

Peter K
 
S

Sue Mosher [MVP-Outlook]

That's because you're trying to run a Word macro within the Outlook VBA environment. The solution would be to instantiate a Word.Selection object representing the selection in the open email message, something like this:

Dim objDoc As Word.Document
Dim objSel As Word.Selection
On Error Resume Next
Set objDoc = Application.ActiveInspector.WordEditor
Set objSel = objDoc.Windows(1).Selection
objSel.TypeText "€"
 
G

Guest

Thxs a lot; I wish though they would not have removed Word as Outlook word
processor.

Peter K
 
S

Sue Mosher [MVP-Outlook]

They didn't remove it. They did just the opposite. Word is now the only editor for Outlook, and it's available for all items except sticky notes. That means that item bodies are fully programmable in ways they never were before -- very good news for developers.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
G

Guest

I appreciate what you're saying. From ny view, though, previously my Word
macros worked in Outlook. Now they don't. That part has gotten much more
complicated.

PS: ordered your new book.

Peter K
 
S

Sue Mosher [MVP-Outlook]

I wouldn't call adding a couple of Set statements "much more complicated," certainly not in comparison with the operations in Outlook that really, really are complex.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 

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