Sub MyWdMail()
  Rem *----*----*    *----*----*    *----*----*    *----*----*
  Rem Word文書データ電子メール送信処理
  Rem 作譜:Hitrock Camellia Shinopy
  Rem 言語:Word VBA
  Rem 機能...
  Rem   Wordの文書上にあるデータをコピーして、
  Rem   電子メールの本文に貼り付け送信する。
  Rem 注記...
  Rem   1. Microsoft Outlook上で、下記の手作業による事前設定が必要。
  Rem      Microsoft Outlookのメニューバーの[ツール]から[オプション...]をクリックし、
  Rem      [メール形式]タブの[電子メールの編集にMicrosoft Wordを使用する]チェックボックスを
  Rem      オンにする。
  Rem   2. Microsoft Outlookが起動済みの状態である場合、すぐに電子メールが送信される。
  Rem      起動してない場合は、これを起動して[送受信]ボタンを押して送信する必要がある。
  Rem   3. 警告なしに送信する。
  Rem 履歴...
  Rem   第1版:2006/06/06:作成。
  Rem   第2版:2006/06/11:Microsoft Wordでの手作業による事前設定が不要になるよう修正した。
  Rem   第3版:2006/06/25:myMail.BodyFormatの設定の不具合を修正した。
  Rem *----*----*    *----*----*    *----*----*    *----*----*
  Rem 参照設定する場合...
  Rem   Microsoft Outlook 10.0 Object Library
  Rem *----*----*    *----*----*    *----*----*    *----*----*
  Dim myOutlook As Variant ' Outlook.Application
  Dim myMail As Variant ' MailItem
  Dim myCmmdBar As CommandBar
  Dim myCtrl As CommandBarControl
  '
  Selection.WholeStory
  Selection.Copy
  Selection.Collapse wdCollapseStart
  '
  On Error Resume Next
  Set myOutlook = GetObject(, "Outlook.Application")
  If Err.Number <> 0 Then
    Set myOutlook = CreateObject("Outlook.Application")
  End If
  On Error GoTo 0
  '
  Set myMail = myOutlook.CreateItem(0) ' = myOutlook.CreateItem(olMailItem)
  myMail.Subject = "このメールはテストです。"
  myMail.To = "xxxxxxxxx@xxx.com"
  myMail.BCC = "xxxxxx@xxxx.ne.jp"
  myMail.Body = "下記の通り、お知らせ致します。" & vbCrLf & vbCrLf
  myMail.FlagRequest = "凄い!"
  myMail.Importance = 2 ' = olImportanceHigh
  Rem   olImportanceHigh olImportanceLow olImportanceNormal
  Rem メッセージ形式...
  Rem   テキスト形式の場合、書式設定(文字色・蛍光ペン書式など)は無効になる。
  myMail.BodyFormat = 1 ' = olFormatPlain / 2 = olFormatHTML
  myMail.Display
  '
  Selection.EndKey Unit:=wdStory, Extend:=wdMove
  On Error Resume Next ' 文書に何も入力されていない場合に対処。
  Selection.Paste
  On Error GoTo 0
  '
  On Error Resume Next
  Application.CommandBars("Zzz").Delete
  On Error GoTo 0
  '
  Set myCmmdBar = Application.CommandBars.Add(Name:="Zzz", Position:=msoBarPopup, Temporary:=True)
  With myCmmdBar.Controls
    Set myCtrl = .Add(Type:=msoControlButton, ID:=3708)
    With myCtrl
      .Caption = "送信"
      .DescriptionText = "電子メールの送信コマンドを実行します。"
      .Execute
    End With
  End With
  myCmmdBar.Delete
  '
  Set myOutlook = Nothing
  Set myMail = Nothing
  Set myCmmdBar = Nothing
  Set myCtrl = Nothing
End Sub ' MyWdMail *----*----*    *----*----*    *----*----*    *----*----*
inserted by FC2 system