ido
02-17-2013, 03:04 PM
I'm trying to edit mail in the inbox using a macro. The code go like this:
1 Public Sub UseWord()
2 Dim Ins As Outlook.Inspector
3 Dim Document As Word.Document
4 Dim Word As Word.Application
5 Dim Selection As Word.Selection
6 Set Ins = Application.ActiveInspector
7 Set Document = Ins.WordEditor
8 Set Word = Document.Application
9 Set Selection = Word.Selection
10 Selection.MoveDown Unit:=wdLine, Count:=1
11 Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
12 Selection.HomeKey Unit:=wdStory
13 Selection.MoveDown Unit:=wdLine, Count:=9, Extend:=wdExtend
14 Selection.Font.Name = "Arial"
15 Selection.HomeKey Unit:=wdStory
16 End Sub
When the program reaches line 14, it stops and shows this message:
Run-time error '4605':
This method or property is not available because the document is
locked for editing.
I know that manually editing the income mail requires the following steps:
1. Select the message
2. Open it
3. Access tab "Message"
4. Click Actions, and select Edit Message.
When I reach this point (after step 4) the massage can be edited. I do not know how to write those 4 steps in the macro. Can anyone help?
1 Public Sub UseWord()
2 Dim Ins As Outlook.Inspector
3 Dim Document As Word.Document
4 Dim Word As Word.Application
5 Dim Selection As Word.Selection
6 Set Ins = Application.ActiveInspector
7 Set Document = Ins.WordEditor
8 Set Word = Document.Application
9 Set Selection = Word.Selection
10 Selection.MoveDown Unit:=wdLine, Count:=1
11 Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
12 Selection.HomeKey Unit:=wdStory
13 Selection.MoveDown Unit:=wdLine, Count:=9, Extend:=wdExtend
14 Selection.Font.Name = "Arial"
15 Selection.HomeKey Unit:=wdStory
16 End Sub
When the program reaches line 14, it stops and shows this message:
Run-time error '4605':
This method or property is not available because the document is
locked for editing.
I know that manually editing the income mail requires the following steps:
1. Select the message
2. Open it
3. Access tab "Message"
4. Click Actions, and select Edit Message.
When I reach this point (after step 4) the massage can be edited. I do not know how to write those 4 steps in the macro. Can anyone help?