
MS Word 2000 - how to move focus to the message fody from email header ?
My client uses MS Word 2000 as email editor in Outlook 2000.
I wrote macro that is form activated by custom button, where user
needs to put some info. This info needs to be populated in email body.
The problem is that if the cursor is positioned in one of the
following fields : To, CC, Bcc, Subject - every time i try to populate
text from the form in the message body - I get error "Runtime error
4605" :
this method or property is not available because the current selection
is in email header"
if prior to clickin button and opening the form I position the cursor
in email body - everything works fine.
Any suggestions on how to move programmatically to the message body
(verify that cursor is in message body) before text is inserted ?
Thx,
Alex
P.S. here is the actual code :
Private Sub CommandButton1_Click()
Dim strLink As String
strLink = vbCrLf +
" http://www.*-*-*.com/ ;
If Trim(txtPR.Text) <> "" Then
If Application.FocusInMailHeader Then
ActiveWindow.SetFocus
End If
Set myDocument = ActiveDocument
myDocument.Bookmarks(1).Range.InsertBefore "yourdata" + txtPR.Text
Call Unload(Me)
Else
MsgBox "Please enter PR Number"
End If
End Sub