-
copy selected e-mail body
hey, guys!
I have created a userform that contains a TextBox1. I am adding a feature that would work like this:
select some text from the e-mial body --> hit a shortcut key --> the userform is shown --> the selected text appears in the TextBox1
I have most of the code
[VBA]
Sub CopySelctedText()
Dim objOL As Application
Dim objDoc As Object
Dim objSel As Object
Set objOL = Application
Set objDoc = objOL.ActiveInspector.WordEditor
Set objSel = objDoc.Windows(1).selection
UserForm1.Show
UserForm1.TextBox1.Value = objSel
end sub[/VBA]
But the problem is that the macro has to be run twice to work properly. Meaning, I select a text, and I need to run the macro twice before the selected text appears in the text-box. I am not sure why it is not acting as desired...?
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules