A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Outlook 2007 Macro: Paste - Paste Special - Unformatted Text



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 22nd 09, 04:13 AM posted to microsoft.public.outlook.program_vba
Gary Petersen
external usenet poster
 
Posts: 9
Default Outlook 2007 Macro: Paste - Paste Special - Unformatted Text

I'd like to assign a macro in Outlook 2007 to a Toolbar button that would
execute the equivalent of these clicks when there is formatted text in the
Windows clipboard:

1. Click the Paste icon by the bottom arrow
2. Click the Paste Special link.
3. Click the Unformatted Text link.

I have similar macros in Excel 2007 and Word 2007 but haven't been able to
get one to work in Outlook 2007 / VBA. What would the VBA code for such a
macro be?

When I try code similar to what I use in Word, I get a Run time error '424'
Object required error. I'm obviously not defining an object correctly, but
I've not been able to figure out how to do that properly. Thanks for the
help.

--
Gary Petersen

Ads
  #2  
Old August 22nd 09, 04:07 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Outlook 2007 Macro: Paste - Paste Special - Unformatted Text

You probably just need to modify your code so that it uses a Word.Selection
object deriveed from the Outlook item you're working with. I've posted an
example at
http://turtleflock-ol2007.spaces.liv...E3D8!579.entry
that shows how to do that.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Gary Petersen" wrote in message
...
I'd like to assign a macro in Outlook 2007 to a Toolbar button that would
execute the equivalent of these clicks when there is formatted text in the
Windows clipboard:

1. Click the Paste icon by the bottom arrow
2. Click the Paste Special link.
3. Click the Unformatted Text link.

I have similar macros in Excel 2007 and Word 2007 but haven't been able to
get one to work in Outlook 2007 / VBA. What would the VBA code for such a
macro be?

When I try code similar to what I use in Word, I get a Run time error
'424'
Object required error. I'm obviously not defining an object correctly,
but
I've not been able to figure out how to do that properly. Thanks for the
help.

--
Gary Petersen



  #3  
Old August 23rd 09, 05:19 AM posted to microsoft.public.outlook.program_vba
Gary Petersen
external usenet poster
 
Posts: 9
Default Outlook 2007 Macro: Paste - Paste Special - Unformatted Text

Thanks for the reply and link, Sue. So if my Word 2007 macro to paste
unformatted text is this:

Sub Paste_Unformatted_Text()
'
' Paste_Unformatted_Text Macro
'
'
Selection.PasteSpecial Link:=False, DataType:=wdPasteText
End Sub

Would my equivalent Outlook 2007 macro be this?

Sub Paste_Special_Unformatted()
Dim objDoc As Word.Document
Dim objSel As Word.Selection
On Error Resume Next
' get a Word.Selection from the open Outlook item
Set objDoc = Application.ActiveInspector.WordEditor
Set objSel = objDoc.Windows(1).Selection
' now do what you want with the Selection
objSel.PasteSpecial Link:=False, DataType:=wdPasteText
Set objDoc = Nothing
Set objSel = Nothing
End Sub

I don't get the error message with this, but it also doesn't appear to do
anything. Where am I going wrong?

Thanks again for your help. I do appreciate it.

Gary Petersen
--
Gary Petersen



"Sue Mosher [MVP]" wrote:

You probably just need to modify your code so that it uses a Word.Selection
object deriveed from the Outlook item you're working with. I've posted an
example at
http://turtleflock-ol2007.spaces.liv...E3D8!579.entry
that shows how to do that.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Gary Petersen" wrote in message
...
I'd like to assign a macro in Outlook 2007 to a Toolbar button that would
execute the equivalent of these clicks when there is formatted text in the
Windows clipboard:

1. Click the Paste icon by the bottom arrow
2. Click the Paste Special link.
3. Click the Unformatted Text link.

I have similar macros in Excel 2007 and Word 2007 but haven't been able to
get one to work in Outlook 2007 / VBA. What would the VBA code for such a
macro be?

When I try code similar to what I use in Word, I get a Run time error
'424'
Object required error. I'm obviously not defining an object correctly,
but
I've not been able to figure out how to do that properly. Thanks for the
help.

--
Gary Petersen




  #4  
Old August 23rd 09, 02:54 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Outlook 2007 Macro: Paste - Paste Special - Unformatted Text

Nothing specific jumps out at me as a problem. Have you tried commenting out
the On Error Resume Next statement so you can see any errors as you step
through the code?

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Gary Petersen" wrote in message
...
Thanks for the reply and link, Sue. So if my Word 2007 macro to paste
unformatted text is this:

Sub Paste_Unformatted_Text()
'
' Paste_Unformatted_Text Macro
'
'
Selection.PasteSpecial Link:=False, DataType:=wdPasteText
End Sub

Would my equivalent Outlook 2007 macro be this?

Sub Paste_Special_Unformatted()
Dim objDoc As Word.Document
Dim objSel As Word.Selection
On Error Resume Next
' get a Word.Selection from the open Outlook item
Set objDoc = Application.ActiveInspector.WordEditor
Set objSel = objDoc.Windows(1).Selection
' now do what you want with the Selection
objSel.PasteSpecial Link:=False, DataType:=wdPasteText
Set objDoc = Nothing
Set objSel = Nothing
End Sub

I don't get the error message with this, but it also doesn't appear to do
anything. Where am I going wrong?


"Sue Mosher [MVP]" wrote:

You probably just need to modify your code so that it uses a
Word.Selection
object deriveed from the Outlook item you're working with. I've posted an
example at
http://turtleflock-ol2007.spaces.liv...E3D8!579.entry
that shows how to do that.



"Gary Petersen" wrote in message
...
I'd like to assign a macro in Outlook 2007 to a Toolbar button that
would
execute the equivalent of these clicks when there is formatted text in
the
Windows clipboard:

1. Click the Paste icon by the bottom arrow
2. Click the Paste Special link.
3. Click the Unformatted Text link.

I have similar macros in Excel 2007 and Word 2007 but haven't been able
to
get one to work in Outlook 2007 / VBA. What would the VBA code for such
a
macro be?

When I try code similar to what I use in Word, I get a Run time error
'424'
Object required error. I'm obviously not defining an object correctly,
but
I've not been able to figure out how to do that properly. Thanks for
the
help.

--
Gary Petersen






  #5  
Old August 25th 09, 02:14 AM posted to microsoft.public.outlook.program_vba
Gary Petersen
external usenet poster
 
Posts: 9
Default Outlook 2007 Macro: Paste - Paste Special - Unformatted Text

I did, here at home, but got no response when I tried to run the macro. I'll
try it again at work, which is mostly where I want the macro running. I'm
also borrowing a copy of your book from a local library to see what I can
learn there. Thanks,

--
Gary Petersen



"Sue Mosher [MVP]" wrote:

Nothing specific jumps out at me as a problem. Have you tried commenting out
the On Error Resume Next statement so you can see any errors as you step
through the code?

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Gary Petersen" wrote in message
...
Thanks for the reply and link, Sue. So if my Word 2007 macro to paste
unformatted text is this:

Sub Paste_Unformatted_Text()
'
' Paste_Unformatted_Text Macro
'
'
Selection.PasteSpecial Link:=False, DataType:=wdPasteText
End Sub

Would my equivalent Outlook 2007 macro be this?

Sub Paste_Special_Unformatted()
Dim objDoc As Word.Document
Dim objSel As Word.Selection
On Error Resume Next
' get a Word.Selection from the open Outlook item
Set objDoc = Application.ActiveInspector.WordEditor
Set objSel = objDoc.Windows(1).Selection
' now do what you want with the Selection
objSel.PasteSpecial Link:=False, DataType:=wdPasteText
Set objDoc = Nothing
Set objSel = Nothing
End Sub

I don't get the error message with this, but it also doesn't appear to do
anything. Where am I going wrong?


"Sue Mosher [MVP]" wrote:

You probably just need to modify your code so that it uses a
Word.Selection
object deriveed from the Outlook item you're working with. I've posted an
example at
http://turtleflock-ol2007.spaces.liv...E3D8!579.entry
that shows how to do that.



"Gary Petersen" wrote in message
...
I'd like to assign a macro in Outlook 2007 to a Toolbar button that
would
execute the equivalent of these clicks when there is formatted text in
the
Windows clipboard:

1. Click the Paste icon by the bottom arrow
2. Click the Paste Special link.
3. Click the Unformatted Text link.

I have similar macros in Excel 2007 and Word 2007 but haven't been able
to
get one to work in Outlook 2007 / VBA. What would the VBA code for such
a
macro be?

When I try code similar to what I use in Word, I get a Run time error
'424'
Object required error. I'm obviously not defining an object correctly,
but
I've not been able to figure out how to do that properly. Thanks for
the
help.

--
Gary Petersen







  #6  
Old August 25th 09, 03:02 AM posted to microsoft.public.outlook.program_vba
Gary Petersen
external usenet poster
 
Posts: 9
Default Outlook 2007 Macro: Paste - Paste Special - Unformatted Text

I'm getting a "Compile Error: User-defined type not defined error" now,
regardless of whether I comment out the On Error Resume Next statement. I
should have your book to reference tomorrow. This is much more work than I
expected it would be. Thanks for your continued help.

Gary Petersen


"Sue Mosher [MVP]" wrote:

Nothing specific jumps out at me as a problem. Have you tried commenting out
the On Error Resume Next statement so you can see any errors as you step
through the code?

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Gary Petersen" wrote in message
...
Thanks for the reply and link, Sue. So if my Word 2007 macro to paste
unformatted text is this:

Sub Paste_Unformatted_Text()
'
' Paste_Unformatted_Text Macro
'
'
Selection.PasteSpecial Link:=False, DataType:=wdPasteText
End Sub

Would my equivalent Outlook 2007 macro be this?

Sub Paste_Special_Unformatted()
Dim objDoc As Word.Document
Dim objSel As Word.Selection
On Error Resume Next
' get a Word.Selection from the open Outlook item
Set objDoc = Application.ActiveInspector.WordEditor
Set objSel = objDoc.Windows(1).Selection
' now do what you want with the Selection
objSel.PasteSpecial Link:=False, DataType:=wdPasteText
Set objDoc = Nothing
Set objSel = Nothing
End Sub

I don't get the error message with this, but it also doesn't appear to do
anything. Where am I going wrong?


"Sue Mosher [MVP]" wrote:

You probably just need to modify your code so that it uses a
Word.Selection
object deriveed from the Outlook item you're working with. I've posted an
example at
http://turtleflock-ol2007.spaces.liv...E3D8!579.entry
that shows how to do that.



"Gary Petersen" wrote in message
...
I'd like to assign a macro in Outlook 2007 to a Toolbar button that
would
execute the equivalent of these clicks when there is formatted text in
the
Windows clipboard:

1. Click the Paste icon by the bottom arrow
2. Click the Paste Special link.
3. Click the Unformatted Text link.

I have similar macros in Excel 2007 and Word 2007 but haven't been able
to
get one to work in Outlook 2007 / VBA. What would the VBA code for such
a
macro be?

When I try code similar to what I use in Word, I get a Run time error
'424'
Object required error. I'm obviously not defining an object correctly,
but
I've not been able to figure out how to do that properly. Thanks for
the
help.

--
Gary Petersen







  #7  
Old August 25th 09, 03:52 AM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Outlook 2007 Macro: Paste - Paste Special - Unformatted Text

Did you remember to use Tools | References to add a reference to the
Microsoft Word library?

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Gary Petersen" wrote in message
...
I'm getting a "Compile Error: User-defined type not defined error" now,
regardless of whether I comment out the On Error Resume Next statement. I
should have your book to reference tomorrow. This is much more work than
I
expected it would be. Thanks for your continued help.

Gary Petersen


"Sue Mosher [MVP]" wrote:

Nothing specific jumps out at me as a problem. Have you tried commenting
out
the On Error Resume Next statement so you can see any errors as you step
through the code?

"Gary Petersen" wrote in message
...
Thanks for the reply and link, Sue. So if my Word 2007 macro to paste
unformatted text is this:

Sub Paste_Unformatted_Text()
'
' Paste_Unformatted_Text Macro
'
'
Selection.PasteSpecial Link:=False, DataType:=wdPasteText
End Sub

Would my equivalent Outlook 2007 macro be this?

Sub Paste_Special_Unformatted()
Dim objDoc As Word.Document
Dim objSel As Word.Selection
On Error Resume Next
' get a Word.Selection from the open Outlook item
Set objDoc = Application.ActiveInspector.WordEditor
Set objSel = objDoc.Windows(1).Selection
' now do what you want with the Selection
objSel.PasteSpecial Link:=False, DataType:=wdPasteText
Set objDoc = Nothing
Set objSel = Nothing
End Sub

I don't get the error message with this, but it also doesn't appear to
do
anything. Where am I going wrong?


"Sue Mosher [MVP]" wrote:

You probably just need to modify your code so that it uses a
Word.Selection
object deriveed from the Outlook item you're working with. I've posted
an
example at
http://turtleflock-ol2007.spaces.liv...E3D8!579.entry
that shows how to do that.



"Gary Petersen" wrote in
message
...
I'd like to assign a macro in Outlook 2007 to a Toolbar button that
would
execute the equivalent of these clicks when there is formatted text
in
the
Windows clipboard:

1. Click the Paste icon by the bottom arrow
2. Click the Paste Special link.
3. Click the Unformatted Text link.

I have similar macros in Excel 2007 and Word 2007 but haven't been
able
to
get one to work in Outlook 2007 / VBA. What would the VBA code for
such
a
macro be?

When I try code similar to what I use in Word, I get a Run time
error
'424'
Object required error. I'm obviously not defining an object
correctly,
but
I've not been able to figure out how to do that properly. Thanks
for
the
help.

--
Gary Petersen









  #8  
Old August 26th 09, 03:14 AM posted to microsoft.public.outlook.program_vba
Gary Petersen
external usenet poster
 
Posts: 9
Default Outlook 2007 Macro: Paste - Paste Special - Unformatted Text

No, I didn't. Once I found where to do that (in the Visual Basic Editor, in
case someone else finds this later through searching), it seems to work just
fine here at home. Which pretty much guarantees it will also work on my work
laptop.

Thanks! I've been trying to get this working for a long time. I really
appreciate the help.
--
Gary Petersen



"Sue Mosher [MVP]" wrote:

Did you remember to use Tools | References to add a reference to the
Microsoft Word library?

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Gary Petersen" wrote in message
...
I'm getting a "Compile Error: User-defined type not defined error" now,
regardless of whether I comment out the On Error Resume Next statement. I
should have your book to reference tomorrow. This is much more work than
I
expected it would be. Thanks for your continued help.

Gary Petersen


"Sue Mosher [MVP]" wrote:

Nothing specific jumps out at me as a problem. Have you tried commenting
out
the On Error Resume Next statement so you can see any errors as you step
through the code?

"Gary Petersen" wrote in message
...
Thanks for the reply and link, Sue. So if my Word 2007 macro to paste
unformatted text is this:

Sub Paste_Unformatted_Text()
'
' Paste_Unformatted_Text Macro
'
'
Selection.PasteSpecial Link:=False, DataType:=wdPasteText
End Sub

Would my equivalent Outlook 2007 macro be this?

Sub Paste_Special_Unformatted()
Dim objDoc As Word.Document
Dim objSel As Word.Selection
On Error Resume Next
' get a Word.Selection from the open Outlook item
Set objDoc = Application.ActiveInspector.WordEditor
Set objSel = objDoc.Windows(1).Selection
' now do what you want with the Selection
objSel.PasteSpecial Link:=False, DataType:=wdPasteText
Set objDoc = Nothing
Set objSel = Nothing
End Sub

I don't get the error message with this, but it also doesn't appear to
do
anything. Where am I going wrong?

"Sue Mosher [MVP]" wrote:

You probably just need to modify your code so that it uses a
Word.Selection
object deriveed from the Outlook item you're working with. I've posted
an
example at
http://turtleflock-ol2007.spaces.liv...E3D8!579.entry
that shows how to do that.


"Gary Petersen" wrote in
message
...
I'd like to assign a macro in Outlook 2007 to a Toolbar button that
would
execute the equivalent of these clicks when there is formatted text
in
the
Windows clipboard:

1. Click the Paste icon by the bottom arrow
2. Click the Paste Special link.
3. Click the Unformatted Text link.

I have similar macros in Excel 2007 and Word 2007 but haven't been
able
to
get one to work in Outlook 2007 / VBA. What would the VBA code for
such
a
macro be?

When I try code similar to what I use in Word, I get a Run time
error
'424'
Object required error. I'm obviously not defining an object
correctly,
but
I've not been able to figure out how to do that properly. Thanks
for
the
help.

--
Gary Petersen










  #9  
Old August 31st 09, 05:04 PM posted to microsoft.public.outlook.program_vba
Tony Hoff
external usenet poster
 
Posts: 1
Default Outlook 2007 Macro: Paste - Paste Special - Unformatted Text

Thanks! This works lie a charm!


"Sue Mosher [MVP]" wrote:

Nothing specific jumps out at me as a problem. Have you tried commenting out
the On Error Resume Next statement so you can see any errors as you step
through the code?

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Gary Petersen" wrote in message
...
Thanks for the reply and link, Sue. So if my Word 2007 macro to paste
unformatted text is this:

Sub Paste_Unformatted_Text()
'
' Paste_Unformatted_Text Macro
'
'
Selection.PasteSpecial Link:=False, DataType:=wdPasteText
End Sub

Would my equivalent Outlook 2007 macro be this?

Sub Paste_Special_Unformatted()
Dim objDoc As Word.Document
Dim objSel As Word.Selection
On Error Resume Next
' get a Word.Selection from the open Outlook item
Set objDoc = Application.ActiveInspector.WordEditor
Set objSel = objDoc.Windows(1).Selection
' now do what you want with the Selection
objSel.PasteSpecial Link:=False, DataType:=wdPasteText
Set objDoc = Nothing
Set objSel = Nothing
End Sub

I don't get the error message with this, but it also doesn't appear to do
anything. Where am I going wrong?


"Sue Mosher [MVP]" wrote:

You probably just need to modify your code so that it uses a
Word.Selection
object deriveed from the Outlook item you're working with. I've posted an
example at
http://turtleflock-ol2007.spaces.liv...E3D8!579.entry
that shows how to do that.



"Gary Petersen" wrote in message
...
I'd like to assign a macro in Outlook 2007 to a Toolbar button that
would
execute the equivalent of these clicks when there is formatted text in
the
Windows clipboard:

1. Click the Paste icon by the bottom arrow
2. Click the Paste Special link.
3. Click the Unformatted Text link.

I have similar macros in Excel 2007 and Word 2007 but haven't been able
to
get one to work in Outlook 2007 / VBA. What would the VBA code for such
a
macro be?

When I try code similar to what I use in Word, I get a Run time error
'424'
Object required error. I'm obviously not defining an object correctly,
but
I've not been able to figure out how to do that properly. Thanks for
the
help.

--
Gary Petersen







  #10  
Old December 28th 09, 04:37 PM posted to microsoft.public.outlook.program_vba
Curt
external usenet poster
 
Posts: 19
Default picture

Your code for Euro seems it could be modifyed for my applicatio. I have used
excel & word macros yet do not understand outlook vba. I want to insert my
signature with a picture in new mail. Outlook will allow this on reply or
forward only. Need a macro that will work on new mail. Any direction
appreciated.
Thanks
Sub Euro()
Dim objDoc As Word.Document
Dim objSel As Word.Selection
On Error Resume Next
' get a Word.Selection from the open Outlook item
Set objDoc = Application.ActiveInspector.WordEditor
Set objSel = objDoc.Windows(1).Selection
' now do what you want with the Selection
objSel.TypeText "€"
Set objDoc = Nothing
Set objSel = Nothing
End Sub


"Sue Mosher [MVP]" wrote:

You probably just need to modify your code so that it uses a Word.Selection
object deriveed from the Outlook item you're working with. I've posted an
example at
http://turtleflock-ol2007.spaces.liv...E3D8!579.entry
that shows how to do that.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Gary Petersen" wrote in message
...
I'd like to assign a macro in Outlook 2007 to a Toolbar button that would
execute the equivalent of these clicks when there is formatted text in the
Windows clipboard:

1. Click the Paste icon by the bottom arrow
2. Click the Paste Special link.
3. Click the Unformatted Text link.

I have similar macros in Excel 2007 and Word 2007 but haven't been able to
get one to work in Outlook 2007 / VBA. What would the VBA code for such a
macro be?

When I try code similar to what I use in Word, I get a Run time error
'424'
Object required error. I'm obviously not defining an object correctly,
but
I've not been able to figure out how to do that properly. Thanks for the
help.

--
Gary Petersen




 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Paste Special Unformatted Text in Outlook Gary Petersen Outlook and VBA 2 March 4th 09 07:08 PM
using outlook 2007 I can no longer paste jpg pictures into the text area Adam Raff Outlook - General Queries 2 September 29th 08 05:39 PM
Paste Special Macro ILv2Xlr8 Outlook and VBA 0 December 17th 07 03:24 PM
Unformatted Paste in Outlook 2007 Chris Boorman Outlook - General Queries 0 October 30th 07 05:27 AM
Paste Special livetohike Outlook - General Queries 0 September 15th 07 10:55 PM


All times are GMT +1. The time now is 10:03 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright 2004-2020 Outlook Banter.
The comments are property of their posters.