0
我有一個宏,我寫在vba中獲取選定的文本在電子郵件中,現在顯示它在一個MsgBox。VBA宏選定的文本Outlook 2010
這個工程很好,當我運行與選定的文本在電子郵件與自己的窗口中打開電子郵件消息的宏。
當我嘗試這與在主Outlook程序的電子郵件窗格中選擇文本它給了我一個錯誤「對象變量或帶塊變量未設置」這是從「設置督察」現身線
有任何想法嗎?
Sub showseltext()
Dim msg As Outlook.MailItem
Dim insp As Outlook.Inspector
Set insp = Application.ActiveInspector
If insp.CurrentItem.Class = olMail Then
Set msg = insp.CurrentItem
If insp.EditorType = olEditorWord Then
Set hed = msg.GetInspector.WordEditor
Set appWord = hed.Application
Set rng = appWord.Selection
MsgBox (rng)
End If
End If
Set appWord = Nothing
Set insp = Nothing
Set rng = Nothing
Set hed = Nothing
Set msg = Nothing
End Sub